Skip to content

Commit afcf0a2

Browse files
committed
Merge tag 'xfs-for-linus-3.15-rc5' of git://oss.sgi.com/xfs/xfs
Pull xfs fixes from Dave Chinner: "The main fix is adding support for default ACLs on O_TMPFILE opened inodes to bring XFS into line with other filesystems. Metadata CRCs are now also considered well enough tested to be fully supported, so we're removing the shouty warnings issued at mount time for filesystems with that format. And there's transaction block reservation overrun fix. Summary: - fix a remote attribute size calculation bug that leads to a transaction overrun - add default ACLs to O_TMPFILE files - Remove the EXPERIMENTAL tag from filesystems with metadata CRC support" * tag 'xfs-for-linus-3.15-rc5' of git://oss.sgi.com/xfs/xfs: xfs: remote attribute overwrite causes transaction overrun xfs: initialize default acls for ->tmpfile() xfs: fully support v5 format filesystems
2 parents f322e26 + 8275cdd commit afcf0a2

File tree

9 files changed

+77
-50
lines changed

9 files changed

+77
-50
lines changed

fs/xfs/xfs_attr.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ xfs_attr_calc_size(
213213
* Out of line attribute, cannot double split, but
214214
* make room for the attribute value itself.
215215
*/
216-
uint dblocks = XFS_B_TO_FSB(mp, valuelen);
216+
uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
217217
nblks += dblocks;
218218
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK);
219219
}
@@ -698,11 +698,22 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
698698

699699
trace_xfs_attr_leaf_replace(args);
700700

701+
/* save the attribute state for later removal*/
701702
args->op_flags |= XFS_DA_OP_RENAME; /* an atomic rename */
702703
args->blkno2 = args->blkno; /* set 2nd entry info*/
703704
args->index2 = args->index;
704705
args->rmtblkno2 = args->rmtblkno;
705706
args->rmtblkcnt2 = args->rmtblkcnt;
707+
args->rmtvaluelen2 = args->rmtvaluelen;
708+
709+
/*
710+
* clear the remote attr state now that it is saved so that the
711+
* values reflect the state of the attribute we are about to
712+
* add, not the attribute we just found and will remove later.
713+
*/
714+
args->rmtblkno = 0;
715+
args->rmtblkcnt = 0;
716+
args->rmtvaluelen = 0;
706717
}
707718

708719
/*
@@ -794,6 +805,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
794805
args->blkno = args->blkno2;
795806
args->rmtblkno = args->rmtblkno2;
796807
args->rmtblkcnt = args->rmtblkcnt2;
808+
args->rmtvaluelen = args->rmtvaluelen2;
797809
if (args->rmtblkno) {
798810
error = xfs_attr_rmtval_remove(args);
799811
if (error)
@@ -999,13 +1011,22 @@ xfs_attr_node_addname(xfs_da_args_t *args)
9991011

10001012
trace_xfs_attr_node_replace(args);
10011013

1014+
/* save the attribute state for later removal*/
10021015
args->op_flags |= XFS_DA_OP_RENAME; /* atomic rename op */
10031016
args->blkno2 = args->blkno; /* set 2nd entry info*/
10041017
args->index2 = args->index;
10051018
args->rmtblkno2 = args->rmtblkno;
10061019
args->rmtblkcnt2 = args->rmtblkcnt;
1020+
args->rmtvaluelen2 = args->rmtvaluelen;
1021+
1022+
/*
1023+
* clear the remote attr state now that it is saved so that the
1024+
* values reflect the state of the attribute we are about to
1025+
* add, not the attribute we just found and will remove later.
1026+
*/
10071027
args->rmtblkno = 0;
10081028
args->rmtblkcnt = 0;
1029+
args->rmtvaluelen = 0;
10091030
}
10101031

10111032
retval = xfs_attr3_leaf_add(blk->bp, state->args);
@@ -1133,6 +1154,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
11331154
args->blkno = args->blkno2;
11341155
args->rmtblkno = args->rmtblkno2;
11351156
args->rmtblkcnt = args->rmtblkcnt2;
1157+
args->rmtvaluelen = args->rmtvaluelen2;
11361158
if (args->rmtblkno) {
11371159
error = xfs_attr_rmtval_remove(args);
11381160
if (error)

fs/xfs/xfs_attr_leaf.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,7 @@ xfs_attr3_leaf_add_work(
12291229
name_rmt->valueblk = 0;
12301230
args->rmtblkno = 1;
12311231
args->rmtblkcnt = xfs_attr3_rmt_blocks(mp, args->valuelen);
1232+
args->rmtvaluelen = args->valuelen;
12321233
}
12331234
xfs_trans_log_buf(args->trans, bp,
12341235
XFS_DA_LOGRANGE(leaf, xfs_attr3_leaf_name(leaf, args->index),
@@ -2167,11 +2168,11 @@ xfs_attr3_leaf_lookup_int(
21672168
if (!xfs_attr_namesp_match(args->flags, entry->flags))
21682169
continue;
21692170
args->index = probe;
2170-
args->valuelen = be32_to_cpu(name_rmt->valuelen);
2171+
args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
21712172
args->rmtblkno = be32_to_cpu(name_rmt->valueblk);
21722173
args->rmtblkcnt = xfs_attr3_rmt_blocks(
21732174
args->dp->i_mount,
2174-
args->valuelen);
2175+
args->rmtvaluelen);
21752176
return XFS_ERROR(EEXIST);
21762177
}
21772178
}
@@ -2220,19 +2221,19 @@ xfs_attr3_leaf_getvalue(
22202221
name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
22212222
ASSERT(name_rmt->namelen == args->namelen);
22222223
ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
2223-
valuelen = be32_to_cpu(name_rmt->valuelen);
2224+
args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);
22242225
args->rmtblkno = be32_to_cpu(name_rmt->valueblk);
22252226
args->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,
2226-
valuelen);
2227+
args->rmtvaluelen);
22272228
if (args->flags & ATTR_KERNOVAL) {
2228-
args->valuelen = valuelen;
2229+
args->valuelen = args->rmtvaluelen;
22292230
return 0;
22302231
}
2231-
if (args->valuelen < valuelen) {
2232-
args->valuelen = valuelen;
2232+
if (args->valuelen < args->rmtvaluelen) {
2233+
args->valuelen = args->rmtvaluelen;
22332234
return XFS_ERROR(ERANGE);
22342235
}
2235-
args->valuelen = valuelen;
2236+
args->valuelen = args->rmtvaluelen;
22362237
}
22372238
return 0;
22382239
}
@@ -2519,7 +2520,7 @@ xfs_attr3_leaf_clearflag(
25192520
ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0);
25202521
name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
25212522
name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2522-
name_rmt->valuelen = cpu_to_be32(args->valuelen);
2523+
name_rmt->valuelen = cpu_to_be32(args->rmtvaluelen);
25232524
xfs_trans_log_buf(args->trans, bp,
25242525
XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt)));
25252526
}
@@ -2677,7 +2678,7 @@ xfs_attr3_leaf_flipflags(
26772678
ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0);
26782679
name_rmt = xfs_attr3_leaf_name_remote(leaf1, args->index);
26792680
name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2680-
name_rmt->valuelen = cpu_to_be32(args->valuelen);
2681+
name_rmt->valuelen = cpu_to_be32(args->rmtvaluelen);
26812682
xfs_trans_log_buf(args->trans, bp1,
26822683
XFS_DA_LOGRANGE(leaf1, name_rmt, sizeof(*name_rmt)));
26832684
}

fs/xfs/xfs_attr_list.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ xfs_attr3_leaf_list_int(
447447
args.dp = context->dp;
448448
args.whichfork = XFS_ATTR_FORK;
449449
args.valuelen = valuelen;
450+
args.rmtvaluelen = valuelen;
450451
args.value = kmem_alloc(valuelen, KM_SLEEP | KM_NOFS);
451452
args.rmtblkno = be32_to_cpu(name_rmt->valueblk);
452453
args.rmtblkcnt = xfs_attr3_rmt_blocks(

fs/xfs/xfs_attr_remote.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ xfs_attr_rmtval_get(
337337
struct xfs_buf *bp;
338338
xfs_dablk_t lblkno = args->rmtblkno;
339339
__uint8_t *dst = args->value;
340-
int valuelen = args->valuelen;
340+
int valuelen;
341341
int nmap;
342342
int error;
343343
int blkcnt = args->rmtblkcnt;
@@ -347,7 +347,9 @@ xfs_attr_rmtval_get(
347347
trace_xfs_attr_rmtval_get(args);
348348

349349
ASSERT(!(args->flags & ATTR_KERNOVAL));
350+
ASSERT(args->rmtvaluelen == args->valuelen);
350351

352+
valuelen = args->rmtvaluelen;
351353
while (valuelen > 0) {
352354
nmap = ATTR_RMTVALUE_MAPSIZE;
353355
error = xfs_bmapi_read(args->dp, (xfs_fileoff_t)lblkno,
@@ -415,7 +417,7 @@ xfs_attr_rmtval_set(
415417
* attributes have headers, we can't just do a straight byte to FSB
416418
* conversion and have to take the header space into account.
417419
*/
418-
blkcnt = xfs_attr3_rmt_blocks(mp, args->valuelen);
420+
blkcnt = xfs_attr3_rmt_blocks(mp, args->rmtvaluelen);
419421
error = xfs_bmap_first_unused(args->trans, args->dp, blkcnt, &lfileoff,
420422
XFS_ATTR_FORK);
421423
if (error)
@@ -480,7 +482,7 @@ xfs_attr_rmtval_set(
480482
*/
481483
lblkno = args->rmtblkno;
482484
blkcnt = args->rmtblkcnt;
483-
valuelen = args->valuelen;
485+
valuelen = args->rmtvaluelen;
484486
while (valuelen > 0) {
485487
struct xfs_buf *bp;
486488
xfs_daddr_t dblkno;

fs/xfs/xfs_da_btree.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ typedef struct xfs_da_args {
6060
int index; /* index of attr of interest in blk */
6161
xfs_dablk_t rmtblkno; /* remote attr value starting blkno */
6262
int rmtblkcnt; /* remote attr value block count */
63+
int rmtvaluelen; /* remote attr value length in bytes */
6364
xfs_dablk_t blkno2; /* blkno of 2nd attr leaf of interest */
6465
int index2; /* index of 2nd attr in blk */
6566
xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
6667
int rmtblkcnt2; /* remote attr value block count */
68+
int rmtvaluelen2; /* remote attr value length in bytes */
6769
int op_flags; /* operation flags */
6870
enum xfs_dacmp cmpresult; /* name compare result for lookups */
6971
} xfs_da_args_t;

fs/xfs/xfs_iops.c

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ xfs_cleanup_inode(
124124
xfs_dentry_to_name(&teardown, dentry, 0);
125125

126126
xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
127-
iput(inode);
128127
}
129128

130129
STATIC int
131-
xfs_vn_mknod(
130+
xfs_generic_create(
132131
struct inode *dir,
133132
struct dentry *dentry,
134133
umode_t mode,
135-
dev_t rdev)
134+
dev_t rdev,
135+
bool tmpfile) /* unnamed file */
136136
{
137137
struct inode *inode;
138138
struct xfs_inode *ip = NULL;
@@ -156,8 +156,12 @@ xfs_vn_mknod(
156156
if (error)
157157
return error;
158158

159-
xfs_dentry_to_name(&name, dentry, mode);
160-
error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip);
159+
if (!tmpfile) {
160+
xfs_dentry_to_name(&name, dentry, mode);
161+
error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip);
162+
} else {
163+
error = xfs_create_tmpfile(XFS_I(dir), dentry, mode, &ip);
164+
}
161165
if (unlikely(error))
162166
goto out_free_acl;
163167

@@ -180,7 +184,11 @@ xfs_vn_mknod(
180184
}
181185
#endif
182186

183-
d_instantiate(dentry, inode);
187+
if (tmpfile)
188+
d_tmpfile(dentry, inode);
189+
else
190+
d_instantiate(dentry, inode);
191+
184192
out_free_acl:
185193
if (default_acl)
186194
posix_acl_release(default_acl);
@@ -189,10 +197,22 @@ xfs_vn_mknod(
189197
return -error;
190198

191199
out_cleanup_inode:
192-
xfs_cleanup_inode(dir, inode, dentry);
200+
if (!tmpfile)
201+
xfs_cleanup_inode(dir, inode, dentry);
202+
iput(inode);
193203
goto out_free_acl;
194204
}
195205

206+
STATIC int
207+
xfs_vn_mknod(
208+
struct inode *dir,
209+
struct dentry *dentry,
210+
umode_t mode,
211+
dev_t rdev)
212+
{
213+
return xfs_generic_create(dir, dentry, mode, rdev, false);
214+
}
215+
196216
STATIC int
197217
xfs_vn_create(
198218
struct inode *dir,
@@ -353,6 +373,7 @@ xfs_vn_symlink(
353373

354374
out_cleanup_inode:
355375
xfs_cleanup_inode(dir, inode, dentry);
376+
iput(inode);
356377
out:
357378
return -error;
358379
}
@@ -1053,25 +1074,7 @@ xfs_vn_tmpfile(
10531074
struct dentry *dentry,
10541075
umode_t mode)
10551076
{
1056-
int error;
1057-
struct xfs_inode *ip;
1058-
struct inode *inode;
1059-
1060-
error = xfs_create_tmpfile(XFS_I(dir), dentry, mode, &ip);
1061-
if (unlikely(error))
1062-
return -error;
1063-
1064-
inode = VFS_I(ip);
1065-
1066-
error = xfs_init_security(inode, dir, &dentry->d_name);
1067-
if (unlikely(error)) {
1068-
iput(inode);
1069-
return -error;
1070-
}
1071-
1072-
d_tmpfile(dentry, inode);
1073-
1074-
return 0;
1077+
return xfs_generic_create(dir, dentry, mode, 0, true);
10751078
}
10761079

10771080
static const struct inode_operations xfs_inode_operations = {

fs/xfs/xfs_log.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,13 @@ xfs_log_mount(
616616
int error = 0;
617617
int min_logfsbs;
618618

619-
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
620-
xfs_notice(mp, "Mounting Filesystem");
621-
else {
619+
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
620+
xfs_notice(mp, "Mounting V%d Filesystem",
621+
XFS_SB_VERSION_NUM(&mp->m_sb));
622+
} else {
622623
xfs_notice(mp,
623-
"Mounting filesystem in no-recovery mode. Filesystem will be inconsistent.");
624+
"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent.",
625+
XFS_SB_VERSION_NUM(&mp->m_sb));
624626
ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
625627
}
626628

fs/xfs/xfs_mount.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,6 @@ xfs_mountfs(
743743
new_size *= mp->m_sb.sb_inodesize / XFS_DINODE_MIN_SIZE;
744744
if (mp->m_sb.sb_inoalignmt >= XFS_B_TO_FSBT(mp, new_size))
745745
mp->m_inode_cluster_size = new_size;
746-
xfs_info(mp, "Using inode cluster size of %d bytes",
747-
mp->m_inode_cluster_size);
748746
}
749747

750748
/*

fs/xfs/xfs_sb.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ xfs_mount_validate_sb(
201201
* write validation, we don't need to check feature masks.
202202
*/
203203
if (check_version && XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) {
204-
xfs_alert(mp,
205-
"Version 5 superblock detected. This kernel has EXPERIMENTAL support enabled!\n"
206-
"Use of these features in this kernel is at your own risk!");
207-
208204
if (xfs_sb_has_compat_feature(sbp,
209205
XFS_SB_FEAT_COMPAT_UNKNOWN)) {
210206
xfs_warn(mp,

0 commit comments

Comments
 (0)