Commit 36011ddc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gfs2-5.1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Bob Peterson:
 "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"

* tag 'gfs2-5.1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Fix missed wakeups in find_insert_glock
  gfs2: Fix an incorrect gfs2_assert()
  gfs: no need to check return value of debugfs_create functions
parents e519a8c2 605b0487
...@@ -107,7 +107,7 @@ static int glock_wake_function(wait_queue_entry_t *wait, unsigned int mode, ...@@ -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) 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); return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS);
} }
...@@ -2131,71 +2131,29 @@ static const struct file_operations gfs2_sbstats_fops = { ...@@ -2131,71 +2131,29 @@ static const struct file_operations gfs2_sbstats_fops = {
.release = seq_release, .release = seq_release,
}; };
int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) void gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
{ {
struct dentry *dent; sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
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;
return 0; debugfs_create_file("glocks", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
fail: &gfs2_glocks_fops);
gfs2_delete_debugfs_file(sdp);
return dent ? PTR_ERR(dent) : -ENOMEM; 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) void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
{ {
if (sdp->debugfs_dir) { debugfs_remove_recursive(sdp->debugfs_dir);
if (sdp->debugfs_dentry_glocks) { sdp->debugfs_dir = NULL;
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;
}
} }
int gfs2_register_debugfs(void) void gfs2_register_debugfs(void)
{ {
gfs2_root = debugfs_create_dir("gfs2", NULL); 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) void gfs2_unregister_debugfs(void)
......
...@@ -243,9 +243,9 @@ extern void gfs2_glock_free(struct gfs2_glock *gl); ...@@ -243,9 +243,9 @@ extern void gfs2_glock_free(struct gfs2_glock *gl);
extern int __init gfs2_glock_init(void); extern int __init gfs2_glock_init(void);
extern void gfs2_glock_exit(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 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 void gfs2_unregister_debugfs(void);
extern const struct lm_lockops gfs2_dlm_ops; extern const struct lm_lockops gfs2_dlm_ops;
......
...@@ -853,9 +853,6 @@ struct gfs2_sbd { ...@@ -853,9 +853,6 @@ struct gfs2_sbd {
unsigned long sd_last_warning; unsigned long sd_last_warning;
struct dentry *debugfs_dir; /* debugfs directory */ 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) static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
......
...@@ -59,8 +59,8 @@ static inline u64 gfs2_get_inode_blocks(const struct inode *inode) ...@@ -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) static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change)
{ {
gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change)); change <<= inode->i_blkbits - GFS2_BASIC_BLOCK_SHIFT;
change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK); gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks >= -change));
inode->i_blocks += change; inode->i_blocks += change;
} }
......
...@@ -178,16 +178,12 @@ static int __init init_gfs2_fs(void) ...@@ -178,16 +178,12 @@ static int __init init_gfs2_fs(void)
if (!gfs2_page_pool) if (!gfs2_page_pool)
goto fail_mempool; goto fail_mempool;
error = gfs2_register_debugfs(); gfs2_register_debugfs();
if (error)
goto fail_debugfs;
pr_info("GFS2 installed\n"); pr_info("GFS2 installed\n");
return 0; return 0;
fail_debugfs:
mempool_destroy(gfs2_page_pool);
fail_mempool: fail_mempool:
destroy_workqueue(gfs2_freeze_wq); destroy_workqueue(gfs2_freeze_wq);
fail_wq3: fail_wq3:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment