diff options
author | Bob Peterson <rpeterso@redhat.com> | 2014-01-06 17:16:01 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-01-07 04:43:51 -0500 |
commit | 62e96cf81988101fe9e086b2877307b6adda5197 (patch) | |
tree | d0a98b5e9ccc5ec6d42ec98f3a68dec2628ba8d3 /fs/gfs2 | |
parent | 2b47dad866d04f14c328f888ba5406057b8c7d33 (diff) |
GFS2: Increase i_writecount during gfs2_setattr_chown
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 4acc584038ee..51cf10df83e4 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1623,10 +1623,22 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) | |||
1623 | if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid)) | 1623 | if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid)) |
1624 | ogid = ngid = NO_GID_QUOTA_CHANGE; | 1624 | ogid = ngid = NO_GID_QUOTA_CHANGE; |
1625 | 1625 | ||
1626 | error = gfs2_quota_lock(ip, nuid, ngid); | 1626 | error = get_write_access(inode); |
1627 | if (error) | 1627 | if (error) |
1628 | return error; | 1628 | return error; |
1629 | 1629 | ||
1630 | error = gfs2_rs_alloc(ip); | ||
1631 | if (error) | ||
1632 | goto out; | ||
1633 | |||
1634 | error = gfs2_rindex_update(sdp); | ||
1635 | if (error) | ||
1636 | goto out; | ||
1637 | |||
1638 | error = gfs2_quota_lock(ip, nuid, ngid); | ||
1639 | if (error) | ||
1640 | goto out; | ||
1641 | |||
1630 | if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || | 1642 | if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || |
1631 | !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { | 1643 | !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { |
1632 | error = gfs2_quota_check(ip, nuid, ngid); | 1644 | error = gfs2_quota_check(ip, nuid, ngid); |
@@ -1653,6 +1665,8 @@ out_end_trans: | |||
1653 | gfs2_trans_end(sdp); | 1665 | gfs2_trans_end(sdp); |
1654 | out_gunlock_q: | 1666 | out_gunlock_q: |
1655 | gfs2_quota_unlock(ip); | 1667 | gfs2_quota_unlock(ip); |
1668 | out: | ||
1669 | put_write_access(inode); | ||
1656 | return error; | 1670 | return error; |
1657 | } | 1671 | } |
1658 | 1672 | ||