From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Tue, 07 Jan 2014 13:15:57 +0000 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown In-Reply-To: <892095916.49469226.1389046561115.JavaMail.root@redhat.com> References: <892095916.49469226.1389046561115.JavaMail.root@redhat.com> Message-ID: <1389100557.2706.0.camel@menhir> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I've added this to the -nmw git tree. Thanks, Steve. On Mon, 2014-01-06 at 17:16 -0500, Bob Peterson wrote: > Hi, > > 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. > > Regards, > > Bob Peterson > Red Hat File Systems > > Signed-off-by: Bob Peterson > --- > diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c > index 7119504..87bc229 100644 > --- a/fs/gfs2/inode.c > +++ b/fs/gfs2/inode.c > @@ -1607,10 +1607,22 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) > if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid)) > ogid = ngid = NO_GID_QUOTA_CHANGE; > > - error = gfs2_quota_lock(ip, nuid, ngid); > + error = get_write_access(inode); > if (error) > return error; > > + error = gfs2_rs_alloc(ip); > + if (error) > + goto out; > + > + error = gfs2_rindex_update(sdp); > + if (error) > + goto out; > + > + error = gfs2_quota_lock(ip, nuid, ngid); > + if (error) > + goto out; > + > if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || > !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { > error = gfs2_quota_check(ip, nuid, ngid); > @@ -1637,6 +1649,8 @@ out_end_trans: > gfs2_trans_end(sdp); > out_gunlock_q: > gfs2_quota_unlock(ip); > +out: > + put_write_access(inode); > return error; > } > >