* [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown [not found] <1027021866.49462200.1389046460522.JavaMail.root@redhat.com> @ 2014-01-06 22:16 ` Bob Peterson 2014-01-07 13:15 ` Steven Whitehouse 2014-01-07 15:52 ` Christoph Hellwig 0 siblings, 2 replies; 4+ messages in thread From: Bob Peterson @ 2014-01-06 22:16 UTC (permalink / raw) To: cluster-devel.redhat.com 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 <rpeterso@redhat.com> --- 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; } ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown 2014-01-06 22:16 ` [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown Bob Peterson @ 2014-01-07 13:15 ` Steven Whitehouse 2014-01-07 15:52 ` Christoph Hellwig 1 sibling, 0 replies; 4+ messages in thread From: Steven Whitehouse @ 2014-01-07 13:15 UTC (permalink / raw) To: cluster-devel.redhat.com 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 <rpeterso@redhat.com> > --- > 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; > } > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown 2014-01-06 22:16 ` [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown Bob Peterson 2014-01-07 13:15 ` Steven Whitehouse @ 2014-01-07 15:52 ` Christoph Hellwig 2014-01-07 17:38 ` Bob Peterson 1 sibling, 1 reply; 4+ messages in thread From: Christoph Hellwig @ 2014-01-07 15:52 UTC (permalink / raw) To: cluster-devel.redhat.com On Mon, Jan 06, 2014 at 05:16:01PM -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. Can you explain how gfs2 (ab-)uses i_writecount in the allocator? i_writecunt has very complicated semantics including negative values to deal with mappings for executables, and I can't really see how these high-level semantics interact well with a block allocator. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown 2014-01-07 15:52 ` Christoph Hellwig @ 2014-01-07 17:38 ` Bob Peterson 0 siblings, 0 replies; 4+ messages in thread From: Bob Peterson @ 2014-01-07 17:38 UTC (permalink / raw) To: cluster-devel.redhat.com ----- Original Message ----- | On Mon, Jan 06, 2014 at 05:16:01PM -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. | | Can you explain how gfs2 (ab-)uses i_writecount in the allocator? | i_writecunt has very complicated semantics including negative values | to deal with mappings for executables, and I can't really see how these | high-level semantics interact well with a block allocator. | Hi, GFS2's allocator doesn't use i_writecount per se. With GFS2, the last person to close a file will free the inode's multi-block reservation structure (struct gfs2_blkreserv), which is used by the allocator for reserving blocks in order to reduce fragmentation. For convenience sake (and to not overly bloat the inode structure itself), that structure is sometimes used for ancillary things, like quota manipulations. In my patch, the i_writecount is merely used to prevent file closes from deleting the multi-block reservation structures during that particular use by the GFS2 quota code. Regards, Bob Peterson Red Hat File Systems ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-07 17:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1027021866.49462200.1389046460522.JavaMail.root@redhat.com>
2014-01-06 22:16 ` [Cluster-devel] [GFS2 PATCH] GFS2: Increase i_writecount during gfs2_setattr_chown Bob Peterson
2014-01-07 13:15 ` Steven Whitehouse
2014-01-07 15:52 ` Christoph Hellwig
2014-01-07 17:38 ` Bob Peterson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.