* [Cluster-devel] [PATCH 0/3] GFS2: Pre-pull patch posting (merge window)
@ 2019-03-08 15:02 Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 1/3] gfs: no need to check return value of debugfs_create functions Bob Peterson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bob Peterson @ 2019-03-08 15:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
We've only got three patches ready for this merge window:
- Fix a hang related to missed wakeups for glocks from Andreas Gruenbacher.
- Rework of how gfs2 manages its debugfs files from Greg K-H.
- An incorrect assert when truncating or deleting files from Tim Smith.
Regards,
Bob Peterson
---
Andreas Gruenbacher (1):
gfs2: Fix missed wakeups in find_insert_glock
Greg Kroah-Hartman (1):
gfs: no need to check return value of debugfs_create functions
Tim Smith (1):
gfs2: Fix an incorrect gfs2_assert()
fs/gfs2/glock.c | 72 ++++++++++--------------------------------------
fs/gfs2/glock.h | 4 +--
fs/gfs2/incore.h | 3 --
fs/gfs2/inode.h | 4 +--
fs/gfs2/main.c | 6 +---
5 files changed, 20 insertions(+), 69 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 1/3] gfs: no need to check return value of debugfs_create functions
2019-03-08 15:02 [Cluster-devel] [PATCH 0/3] GFS2: Pre-pull patch posting (merge window) Bob Peterson
@ 2019-03-08 15:02 ` Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 2/3] gfs2: Fix an incorrect gfs2_assert() Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 3/3] gfs2: Fix missed wakeups in find_insert_glock Bob Peterson
2 siblings, 0 replies; 4+ messages in thread
From: Bob Peterson @ 2019-03-08 15:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
There is no need to save the dentries for the debugfs files, so drop
those variables to save a bit of space and make the code simpler.
Cc: Bob Peterson <rpeterso@redhat.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: cluster-devel at redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/glock.c | 70 ++++++++++--------------------------------------
fs/gfs2/glock.h | 4 +--
fs/gfs2/incore.h | 3 ---
fs/gfs2/main.c | 6 +----
4 files changed, 17 insertions(+), 66 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index b92740edc416..f66773c71bcd 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -2131,71 +2131,29 @@ static const struct file_operations gfs2_sbstats_fops = {
.release = seq_release,
};
-int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
-{
- struct dentry *dent;
-
- dent = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
- if (IS_ERR_OR_NULL(dent))
- goto fail;
- sdp->debugfs_dir = dent;
-
- dent = debugfs_create_file("glocks",
- S_IFREG | S_IRUGO,
- sdp->debugfs_dir, sdp,
- &gfs2_glocks_fops);
- if (IS_ERR_OR_NULL(dent))
- goto fail;
- sdp->debugfs_dentry_glocks = dent;
-
- dent = debugfs_create_file("glstats",
- S_IFREG | S_IRUGO,
- sdp->debugfs_dir, sdp,
- &gfs2_glstats_fops);
- if (IS_ERR_OR_NULL(dent))
- goto fail;
- sdp->debugfs_dentry_glstats = dent;
-
- dent = debugfs_create_file("sbstats",
- S_IFREG | S_IRUGO,
- sdp->debugfs_dir, sdp,
- &gfs2_sbstats_fops);
- if (IS_ERR_OR_NULL(dent))
- goto fail;
- sdp->debugfs_dentry_sbstats = dent;
+void gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
+{
+ sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
- return 0;
-fail:
- gfs2_delete_debugfs_file(sdp);
- return dent ? PTR_ERR(dent) : -ENOMEM;
+ debugfs_create_file("glocks", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
+ &gfs2_glocks_fops);
+
+ debugfs_create_file("glstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
+ &gfs2_glstats_fops);
+
+ debugfs_create_file("sbstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
+ &gfs2_sbstats_fops);
}
void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
{
- if (sdp->debugfs_dir) {
- if (sdp->debugfs_dentry_glocks) {
- debugfs_remove(sdp->debugfs_dentry_glocks);
- sdp->debugfs_dentry_glocks = NULL;
- }
- if (sdp->debugfs_dentry_glstats) {
- debugfs_remove(sdp->debugfs_dentry_glstats);
- sdp->debugfs_dentry_glstats = NULL;
- }
- if (sdp->debugfs_dentry_sbstats) {
- debugfs_remove(sdp->debugfs_dentry_sbstats);
- sdp->debugfs_dentry_sbstats = NULL;
- }
- debugfs_remove(sdp->debugfs_dir);
- sdp->debugfs_dir = NULL;
- }
+ debugfs_remove_recursive(sdp->debugfs_dir);
+ sdp->debugfs_dir = NULL;
}
-int gfs2_register_debugfs(void)
+void gfs2_register_debugfs(void)
{
gfs2_root = debugfs_create_dir("gfs2", NULL);
- if (IS_ERR(gfs2_root))
- return PTR_ERR(gfs2_root);
- return gfs2_root ? 0 : -ENOMEM;
}
void gfs2_unregister_debugfs(void)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 8949bf28b249..936b3295839c 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -243,9 +243,9 @@ extern void gfs2_glock_free(struct gfs2_glock *gl);
extern int __init gfs2_glock_init(void);
extern void gfs2_glock_exit(void);
-extern int gfs2_create_debugfs_file(struct gfs2_sbd *sdp);
+extern void gfs2_create_debugfs_file(struct gfs2_sbd *sdp);
extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp);
-extern int gfs2_register_debugfs(void);
+extern void gfs2_register_debugfs(void);
extern void gfs2_unregister_debugfs(void);
extern const struct lm_lockops gfs2_dlm_ops;
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index e10e0b0a7cd5..cdf07b408f54 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -853,9 +853,6 @@ struct gfs2_sbd {
unsigned long sd_last_warning;
struct dentry *debugfs_dir; /* debugfs directory */
- struct dentry *debugfs_dentry_glocks;
- struct dentry *debugfs_dentry_glstats;
- struct dentry *debugfs_dentry_sbstats;
};
static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index c7603063f861..136484ef35d3 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -178,16 +178,12 @@ static int __init init_gfs2_fs(void)
if (!gfs2_page_pool)
goto fail_mempool;
- error = gfs2_register_debugfs();
- if (error)
- goto fail_debugfs;
+ gfs2_register_debugfs();
pr_info("GFS2 installed\n");
return 0;
-fail_debugfs:
- mempool_destroy(gfs2_page_pool);
fail_mempool:
destroy_workqueue(gfs2_freeze_wq);
fail_wq3:
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 2/3] gfs2: Fix an incorrect gfs2_assert()
2019-03-08 15:02 [Cluster-devel] [PATCH 0/3] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 1/3] gfs: no need to check return value of debugfs_create functions Bob Peterson
@ 2019-03-08 15:02 ` Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 3/3] gfs2: Fix missed wakeups in find_insert_glock Bob Peterson
2 siblings, 0 replies; 4+ messages in thread
From: Bob Peterson @ 2019-03-08 15:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Tim Smith <tim.smith@citrix.com>
When updating the inode information after a change in allocation,
convert the change into the same units as the inode's i_blocks count
before comparing it in an assertion.
Also, change the comparison so that it is still possible to set i_blocks
to zero by adding -i_blocks, something that was previously only possible
because of the difference in units.
Signed-off-by: Tim Smith <tim.smith@citrix.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/inode.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 793808263c6d..18d4af7417fa 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -59,8 +59,8 @@ static inline u64 gfs2_get_inode_blocks(const struct inode *inode)
static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change)
{
- gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change));
- change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK);
+ change <<= inode->i_blkbits - GFS2_BASIC_BLOCK_SHIFT;
+ gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks >= -change));
inode->i_blocks += change;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 3/3] gfs2: Fix missed wakeups in find_insert_glock
2019-03-08 15:02 [Cluster-devel] [PATCH 0/3] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 1/3] gfs: no need to check return value of debugfs_create functions Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 2/3] gfs2: Fix an incorrect gfs2_assert() Bob Peterson
@ 2019-03-08 15:02 ` Bob Peterson
2 siblings, 0 replies; 4+ messages in thread
From: Bob Peterson @ 2019-03-08 15:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Andreas Gruenbacher <agruenba@redhat.com>
Mark Syms has reported seeing tasks that are stuck waiting in
find_insert_glock. It turns out that struct lm_lockname contains four padding
bytes on 64-bit architectures that function glock_waitqueue doesn't skip when
hashing the glock name. As a result, we can end up waking up the wrong
waitqueue, and the waiting tasks may be stuck forever.
Fix that by using ht_parms.key_len instead of sizeof(struct lm_lockname) for
the key length.
Reported-by: Mark Syms <mark.syms@citrix.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/glock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f66773c71bcd..d32964cd1117 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -107,7 +107,7 @@ static int glock_wake_function(wait_queue_entry_t *wait, unsigned int mode,
static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name)
{
- u32 hash = jhash2((u32 *)name, sizeof(*name) / 4, 0);
+ u32 hash = jhash2((u32 *)name, ht_parms.key_len / 4, 0);
return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-08 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-08 15:02 [Cluster-devel] [PATCH 0/3] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 1/3] gfs: no need to check return value of debugfs_create functions Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 2/3] gfs2: Fix an incorrect gfs2_assert() Bob Peterson
2019-03-08 15:02 ` [Cluster-devel] [PATCH 3/3] gfs2: Fix missed wakeups in find_insert_glock Bob Peterson
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).