Commit 5fcbab35 authored by Dean Roehrich's avatar Dean Roehrich Committed by Christoph Hellwig

[XFS] Add ATTR_NOLOCK for xfs_setattr to indicate that XFS_IOLOCK is held

SGI Modid: xfs-linux:xfs-kern:190711a
Signed-off-by: default avatarDean Roehrich <roehrich@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@sgi.com>
.
parent 9effd8e6
...@@ -626,6 +626,7 @@ static inline int VN_BAD(struct vnode *vp) ...@@ -626,6 +626,7 @@ static inline int VN_BAD(struct vnode *vp)
#define ATTR_DMI 0x08 /* invocation from a DMI function */ #define ATTR_DMI 0x08 /* invocation from a DMI function */
#define ATTR_LAZY 0x80 /* set/get attributes lazily */ #define ATTR_LAZY 0x80 /* set/get attributes lazily */
#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ #define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */
#define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */
/* /*
* Flags to VOP_FSYNC and VOP_RECLAIM. * Flags to VOP_FSYNC and VOP_RECLAIM.
......
...@@ -305,7 +305,7 @@ xfs_setattr( ...@@ -305,7 +305,7 @@ xfs_setattr(
int mandlock_before, mandlock_after; int mandlock_before, mandlock_after;
struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
int file_owner; int file_owner;
int need_iolock = (flags & ATTR_DMI) == 0; int need_iolock = 1;
vp = BHV_TO_VNODE(bdp); vp = BHV_TO_VNODE(bdp);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
...@@ -384,6 +384,9 @@ xfs_setattr( ...@@ -384,6 +384,9 @@ xfs_setattr(
*/ */
tp = NULL; tp = NULL;
lock_flags = XFS_ILOCK_EXCL; lock_flags = XFS_ILOCK_EXCL;
ASSERT(flags & ATTR_NOLOCK ? flags & ATTR_DMI : 1);
if (flags & ATTR_NOLOCK)
need_iolock = 0;
if (!(mask & XFS_AT_SIZE)) { if (!(mask & XFS_AT_SIZE)) {
if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) ||
(mp->m_flags & XFS_MOUNT_WSYNC)) { (mp->m_flags & XFS_MOUNT_WSYNC)) {
...@@ -4320,7 +4323,7 @@ xfs_free_file_space( ...@@ -4320,7 +4323,7 @@ xfs_free_file_space(
int rt; int rt;
xfs_fileoff_t startoffset_fsb; xfs_fileoff_t startoffset_fsb;
xfs_trans_t *tp; xfs_trans_t *tp;
int need_iolock = (attr_flags & ATTR_DMI) == 0; int need_iolock = 1;
vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
mp = ip->i_mount; mp = ip->i_mount;
...@@ -4348,8 +4351,12 @@ xfs_free_file_space( ...@@ -4348,8 +4351,12 @@ xfs_free_file_space(
return(error); return(error);
} }
ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1);
if (attr_flags & ATTR_NOLOCK)
need_iolock = 0;
if (need_iolock) if (need_iolock)
xfs_ilock(ip, XFS_IOLOCK_EXCL); xfs_ilock(ip, XFS_IOLOCK_EXCL);
rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog),
(__uint8_t)NBPP); (__uint8_t)NBPP);
ilen = len + (offset & (rounding - 1)); ilen = len + (offset & (rounding - 1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment