* [Cluster-devel] GFS2: Pre-pull patch posting (fixes) @ 2013-08-19 8:48 Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 1/5] GFS2: Fix typo in gfs2_create_inode() Steven Whitehouse ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com Hi, Out of these fives patches, the one for ensuring that the number of revokes is not exceeded, and the one for checking the glock is not already held in gfs2_getxattr are the two most important. The latter can be triggered by selinux. The other three patches are very small and fix mostly fairly trivial issues, Steve. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 1/5] GFS2: Fix typo in gfs2_create_inode() 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse @ 2013-08-19 8:48 ` Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 2/5] GFS2: WQ_NON_REENTRANT is meaningless and going away Steven Whitehouse ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com PTR_RET should be PTR_ERR Reported-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index bbb2715..a01b8fd 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -594,7 +594,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, } gfs2_glock_dq_uninit(ghs); if (IS_ERR(d)) - return PTR_RET(d); + return PTR_ERR(d); return error; } else if (error != -ENOENT) { goto fail_gunlock; -- 1.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 2/5] GFS2: WQ_NON_REENTRANT is meaningless and going away 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 1/5] GFS2: Fix typo in gfs2_create_inode() Steven Whitehouse @ 2013-08-19 8:48 ` Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 3/5] GFS2: don't overrun reserved revokes Steven Whitehouse ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com From: Tejun Heo <tj@kernel.org> dbf2576e37 ("workqueue: make all workqueues non-reentrant") made WQ_NON_REENTRANT no-op and the flag is going away. Remove its usages. This patch doesn't introduce any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Cc: cluster-devel at redhat.com diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index e04d0e0..7b0f504 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c @@ -155,7 +155,7 @@ static int __init init_gfs2_fs(void) goto fail_wq; gfs2_control_wq = alloc_workqueue("gfs2_control", - WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0); + WQ_UNBOUND | WQ_FREEZABLE, 0); if (!gfs2_control_wq) goto fail_recovery; -- 1.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 3/5] GFS2: don't overrun reserved revokes 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 1/5] GFS2: Fix typo in gfs2_create_inode() Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 2/5] GFS2: WQ_NON_REENTRANT is meaningless and going away Steven Whitehouse @ 2013-08-19 8:48 ` Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 4/5] GFS2: alloc_workqueue() doesn't return an ERR_PTR Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 5/5] GFS2: Check for glock already held in gfs2_getxattr Steven Whitehouse 4 siblings, 0 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com From: Benjamin Marzinski <bmarzins@redhat.com> When run during fsync, a gfs2_log_flush could happen between the time when gfs2_ail_flush checked the number of blocks to revoke, and when it actually started the transaction to do those revokes. This occassionally caused it to need more revokes than it reserved, causing gfs2 to crash. Instead of just reserving enough revokes to handle the blocks that currently need them, this patch makes gfs2_ail_flush reserve the maximum number of revokes it can, without increasing the total number of reserved log blocks. This patch also passes the number of reserved revokes to __gfs2_ail_flush() so that it doesn't go over its limit and cause a crash like we're seeing. Non-fsync calls to __gfs2_ail_flush will still cause a BUG() necessary revokes are skipped. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 5f2e522..e2e0a90 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -47,7 +47,8 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) * None of the buffers should be dirty, locked, or pinned. */ -static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) +static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync, + unsigned int nr_revokes) { struct gfs2_sbd *sdp = gl->gl_sbd; struct list_head *head = &gl->gl_ail_list; @@ -57,7 +58,9 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) gfs2_log_lock(sdp); spin_lock(&sdp->sd_ail_lock); - list_for_each_entry_safe(bd, tmp, head, bd_ail_gl_list) { + list_for_each_entry_safe_reverse(bd, tmp, head, bd_ail_gl_list) { + if (nr_revokes == 0) + break; bh = bd->bd_bh; if (bh->b_state & b_state) { if (fsync) @@ -65,6 +68,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) gfs2_ail_error(gl, bh); } gfs2_trans_add_revoke(sdp, bd); + nr_revokes--; } GLOCK_BUG_ON(gl, !fsync && atomic_read(&gl->gl_ail_count)); spin_unlock(&sdp->sd_ail_lock); @@ -91,7 +95,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) WARN_ON_ONCE(current->journal_info); current->journal_info = &tr; - __gfs2_ail_flush(gl, 0); + __gfs2_ail_flush(gl, 0, tr.tr_revokes); gfs2_trans_end(sdp); gfs2_log_flush(sdp, NULL); @@ -101,15 +105,19 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) { struct gfs2_sbd *sdp = gl->gl_sbd; unsigned int revokes = atomic_read(&gl->gl_ail_count); + unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64); int ret; if (!revokes) return; - ret = gfs2_trans_begin(sdp, 0, revokes); + while (revokes > max_revokes) + max_revokes += (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header)) / sizeof(u64); + + ret = gfs2_trans_begin(sdp, 0, max_revokes); if (ret) return; - __gfs2_ail_flush(gl, fsync); + __gfs2_ail_flush(gl, fsync, max_revokes); gfs2_trans_end(sdp); gfs2_log_flush(sdp, NULL); } -- 1.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 4/5] GFS2: alloc_workqueue() doesn't return an ERR_PTR 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse ` (2 preceding siblings ...) 2013-08-19 8:48 ` [Cluster-devel] [PATCH 3/5] GFS2: don't overrun reserved revokes Steven Whitehouse @ 2013-08-19 8:48 ` Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 5/5] GFS2: Check for glock already held in gfs2_getxattr Steven Whitehouse 4 siblings, 0 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com From: Dan Carpenter <dan.carpenter@oracle.com> alloc_workqueue() returns a NULL on error, it doesn't return an ERR_PTR. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 9435384..544a809 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1838,14 +1838,14 @@ int __init gfs2_glock_init(void) glock_workqueue = alloc_workqueue("glock_workqueue", WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZABLE, 0); - if (IS_ERR(glock_workqueue)) - return PTR_ERR(glock_workqueue); + if (!glock_workqueue) + return -ENOMEM; gfs2_delete_workqueue = alloc_workqueue("delete_workqueue", WQ_MEM_RECLAIM | WQ_FREEZABLE, 0); - if (IS_ERR(gfs2_delete_workqueue)) { + if (!gfs2_delete_workqueue) { destroy_workqueue(glock_workqueue); - return PTR_ERR(gfs2_delete_workqueue); + return -ENOMEM; } register_shrinker(&glock_shrinker); -- 1.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 5/5] GFS2: Check for glock already held in gfs2_getxattr 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse ` (3 preceding siblings ...) 2013-08-19 8:48 ` [Cluster-devel] [PATCH 4/5] GFS2: alloc_workqueue() doesn't return an ERR_PTR Steven Whitehouse @ 2013-08-19 8:48 ` Steven Whitehouse 4 siblings, 0 replies; 6+ messages in thread From: Steven Whitehouse @ 2013-08-19 8:48 UTC (permalink / raw) To: cluster-devel.redhat.com Since the introduction of atomic_open, gfs2_getxattr can be called with the glock already held, so we need to allow for this. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Reported-by: David Teigland <teigland@redhat.com> Tested-by: David Teigland <teigland@redhat.com> diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index a01b8fd..64915ee 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -1750,6 +1750,10 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, struct gfs2_holder gh; int ret; + /* For selinux during lookup */ + if (gfs2_glock_is_locked_by_me(ip->i_gl)) + return generic_getxattr(dentry, name, data, size); + gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh); ret = gfs2_glock_nq(&gh); if (ret == 0) { -- 1.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-19 8:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-19 8:48 [Cluster-devel] GFS2: Pre-pull patch posting (fixes) Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 1/5] GFS2: Fix typo in gfs2_create_inode() Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 2/5] GFS2: WQ_NON_REENTRANT is meaningless and going away Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 3/5] GFS2: don't overrun reserved revokes Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 4/5] GFS2: alloc_workqueue() doesn't return an ERR_PTR Steven Whitehouse 2013-08-19 8:48 ` [Cluster-devel] [PATCH 5/5] GFS2: Check for glock already held in gfs2_getxattr Steven Whitehouse
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).