aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2014-01-06 17:16:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-25 11:27:11 -0500
commit350f737ed039d2b36329ddcbcdf78e12c6d8c758 (patch)
treeda7fcf9dd5409232bd8950d5105ad7bc92cf70f3 /fs
parent6826621350ecf4ec5f3508aa9e853e60e766e221 (diff)
GFS2: Increase i_writecount during gfs2_setattr_chown
commit 62e96cf81988101fe9e086b2877307b6adda5197 upstream. This patch calls get_write_access in function gfs2_setattr_chown, which merely increases inode->i_writecount for the duration of the function. That will ensure that any file closes won't delete the inode's multi-block reservation while the function is running. It also ensures that a multi-block reservation exists when needed for quota change operations during the chown. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/inode.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 62b484e4a9e4..bc5dac400125 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1536,10 +1536,22 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1536 if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid)) 1536 if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid))
1537 ogid = ngid = NO_GID_QUOTA_CHANGE; 1537 ogid = ngid = NO_GID_QUOTA_CHANGE;
1538 1538
1539 error = gfs2_quota_lock(ip, nuid, ngid); 1539 error = get_write_access(inode);
1540 if (error) 1540 if (error)
1541 return error; 1541 return error;
1542 1542
1543 error = gfs2_rs_alloc(ip);
1544 if (error)
1545 goto out;
1546
1547 error = gfs2_rindex_update(sdp);
1548 if (error)
1549 goto out;
1550
1551 error = gfs2_quota_lock(ip, nuid, ngid);
1552 if (error)
1553 goto out;
1554
1543 if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || 1555 if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) ||
1544 !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { 1556 !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) {
1545 error = gfs2_quota_check(ip, nuid, ngid); 1557 error = gfs2_quota_check(ip, nuid, ngid);
@@ -1566,6 +1578,8 @@ out_end_trans:
1566 gfs2_trans_end(sdp); 1578 gfs2_trans_end(sdp);
1567out_gunlock_q: 1579out_gunlock_q:
1568 gfs2_quota_unlock(ip); 1580 gfs2_quota_unlock(ip);
1581out:
1582 put_write_access(inode);
1569 return error; 1583 return error;
1570} 1584}
1571 1585