Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'xfs-5.19-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:
"There's not a whole lot this time around (I'm still on vacation) but
here are some important fixes for new features merged in -rc1:

- Fix a bug where inode flag changes would accidentally drop nrext64

- Fix a race condition when toggling LARP mode"

* tag 'xfs-5.19-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: preserve DIFLAG2_NREXT64 when setting other inode attributes
xfs: fix variable state usage
xfs: fix TOCTOU race involving the new logged xattrs control knob

+37 -25
+5 -4
fs/xfs/libxfs/xfs_attr.c
··· 997 997 /* 998 998 * We have no control over the attribute names that userspace passes us 999 999 * to remove, so we have to allow the name lookup prior to attribute 1000 - * removal to fail as well. 1000 + * removal to fail as well. Preserve the logged flag, since we need 1001 + * to pass that through to the logging code. 1001 1002 */ 1002 - args->op_flags = XFS_DA_OP_OKNOENT; 1003 + args->op_flags = XFS_DA_OP_OKNOENT | 1004 + (args->op_flags & XFS_DA_OP_LOGGED); 1003 1005 1004 1006 if (args->value) { 1005 1007 XFS_STATS_INC(mp, xs_attr_set); ··· 1441 1439 xfs_attr_node_try_addname( 1442 1440 struct xfs_attr_intent *attr) 1443 1441 { 1444 - struct xfs_da_args *args = attr->xattri_da_args; 1445 1442 struct xfs_da_state *state = attr->xattri_da_state; 1446 1443 struct xfs_da_state_blk *blk; 1447 1444 int error; 1448 1445 1449 - trace_xfs_attr_node_addname(args); 1446 + trace_xfs_attr_node_addname(state->args); 1450 1447 1451 1448 blk = &state->path.blk[state->path.active-1]; 1452 1449 ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
+1 -11
fs/xfs/libxfs/xfs_attr.h
··· 28 28 */ 29 29 #define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ 30 30 31 - static inline bool xfs_has_larp(struct xfs_mount *mp) 32 - { 33 - #ifdef DEBUG 34 - /* Logged xattrs require a V5 super for log_incompat */ 35 - return xfs_has_crc(mp) && xfs_globals.larp; 36 - #else 37 - return false; 38 - #endif 39 - } 40 - 41 31 /* 42 32 * Kernel-internal version of the attrlist cursor. 43 33 */ ··· 614 624 xfs_attr_init_replace_state(struct xfs_da_args *args) 615 625 { 616 626 args->op_flags |= XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE; 617 - if (xfs_has_larp(args->dp->i_mount)) 627 + if (args->op_flags & XFS_DA_OP_LOGGED) 618 628 return xfs_attr_init_remove_state(args); 619 629 return xfs_attr_init_add_state(args); 620 630 }
+1 -1
fs/xfs/libxfs/xfs_attr_leaf.c
··· 1530 1530 if (tmp) 1531 1531 entry->flags |= XFS_ATTR_LOCAL; 1532 1532 if (args->op_flags & XFS_DA_OP_REPLACE) { 1533 - if (!xfs_has_larp(mp)) 1533 + if (!(args->op_flags & XFS_DA_OP_LOGGED)) 1534 1534 entry->flags |= XFS_ATTR_INCOMPLETE; 1535 1535 if ((args->blkno2 == args->blkno) && 1536 1536 (args->index2 <= args->index)) {
+3 -1
fs/xfs/libxfs/xfs_da_btree.h
··· 92 92 #define XFS_DA_OP_NOTIME (1u << 5) /* don't update inode timestamps */ 93 93 #define XFS_DA_OP_REMOVE (1u << 6) /* this is a remove operation */ 94 94 #define XFS_DA_OP_RECOVERY (1u << 7) /* Log recovery operation */ 95 + #define XFS_DA_OP_LOGGED (1u << 8) /* Use intent items to track op */ 95 96 96 97 #define XFS_DA_OP_FLAGS \ 97 98 { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ ··· 102 101 { XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \ 103 102 { XFS_DA_OP_NOTIME, "NOTIME" }, \ 104 103 { XFS_DA_OP_REMOVE, "REMOVE" }, \ 105 - { XFS_DA_OP_RECOVERY, "RECOVERY" } 104 + { XFS_DA_OP_RECOVERY, "RECOVERY" }, \ 105 + { XFS_DA_OP_LOGGED, "LOGGED" } 106 106 107 107 /* 108 108 * Storage for holding state during Btree searches and split/join ops.
+9 -6
fs/xfs/xfs_attr_item.c
··· 413 413 struct xfs_mount *mp = tp->t_mountp; 414 414 struct xfs_attri_log_item *attrip; 415 415 struct xfs_attr_intent *attr; 416 + struct xfs_da_args *args; 416 417 417 418 ASSERT(count == 1); 418 - 419 - if (!xfs_sb_version_haslogxattrs(&mp->m_sb)) 420 - return NULL; 421 419 422 420 /* 423 421 * Each attr item only performs one attribute operation at a time, so ··· 423 425 */ 424 426 attr = list_first_entry_or_null(items, struct xfs_attr_intent, 425 427 xattri_list); 428 + args = attr->xattri_da_args; 429 + 430 + if (!(args->op_flags & XFS_DA_OP_LOGGED)) 431 + return NULL; 426 432 427 433 /* 428 434 * Create a buffer to store the attribute name and value. This buffer ··· 434 432 * and the lower level xattr log items. 435 433 */ 436 434 if (!attr->xattri_nameval) { 437 - struct xfs_da_args *args = attr->xattri_da_args; 438 - 439 435 /* 440 436 * Transfer our reference to the name/value buffer to the 441 437 * deferred work state structure. ··· 617 617 args->namelen = nv->name.i_len; 618 618 args->hashval = xfs_da_hashname(args->name, args->namelen); 619 619 args->attr_filter = attrp->alfi_attr_filter & XFS_ATTRI_FILTER_MASK; 620 - args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT; 620 + args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT | 621 + XFS_DA_OP_LOGGED; 622 + 623 + ASSERT(xfs_sb_version_haslogxattrs(&mp->m_sb)); 621 624 622 625 switch (attr->xattri_op_flags) { 623 626 case XFS_ATTRI_OP_FLAGS_SET:
+2 -1
fs/xfs/xfs_ioctl.c
··· 1096 1096 { 1097 1097 uint64_t di_flags2 = 1098 1098 (ip->i_diflags2 & (XFS_DIFLAG2_REFLINK | 1099 - XFS_DIFLAG2_BIGTIME)); 1099 + XFS_DIFLAG2_BIGTIME | 1100 + XFS_DIFLAG2_NREXT64)); 1100 1101 1101 1102 if (xflags & FS_XFLAG_DAX) 1102 1103 di_flags2 |= XFS_DIFLAG2_DAX;
+16 -1
fs/xfs/xfs_xattr.c
··· 68 68 xlog_drop_incompat_feat(mp->m_log); 69 69 } 70 70 71 + static inline bool 72 + xfs_attr_want_log_assist( 73 + struct xfs_mount *mp) 74 + { 75 + #ifdef DEBUG 76 + /* Logged xattrs require a V5 super for log_incompat */ 77 + return xfs_has_crc(mp) && xfs_globals.larp; 78 + #else 79 + return false; 80 + #endif 81 + } 82 + 71 83 /* 72 84 * Set or remove an xattr, having grabbed the appropriate logging resources 73 85 * prior to calling libxfs. ··· 92 80 bool use_logging = false; 93 81 int error; 94 82 95 - if (xfs_has_larp(mp)) { 83 + ASSERT(!(args->op_flags & XFS_DA_OP_LOGGED)); 84 + 85 + if (xfs_attr_want_log_assist(mp)) { 96 86 error = xfs_attr_grab_log_assist(mp); 97 87 if (error) 98 88 return error; 99 89 90 + args->op_flags |= XFS_DA_OP_LOGGED; 100 91 use_logging = true; 101 92 } 102 93