diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-09 14:52:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-09 14:52:11 -0500 |
commit | 36011ddc78395b59a8a418c37f20bcc18828f1ef (patch) | |
tree | b91a2abc3a49f2cc2945883f5145a059a79b6a18 /fs/gfs2 | |
parent | e519a8c2c3431fbc27e453ff73f5b51df5afe6b5 (diff) | |
parent | 605b0487f0bc1ae9963bf52ece0f5c8055186f81 (diff) |
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
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 72 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 4 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 3 | ||||
-rw-r--r-- | fs/gfs2/inode.h | 4 | ||||
-rw-r--r-- | fs/gfs2/main.c | 6 |
5 files changed, 20 insertions, 69 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index b92740edc416..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, | |||
107 | 107 | ||
108 | static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name) | 108 | static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name) |
109 | { | 109 | { |
110 | u32 hash = jhash2((u32 *)name, sizeof(*name) / 4, 0); | 110 | u32 hash = jhash2((u32 *)name, ht_parms.key_len / 4, 0); |
111 | 111 | ||
112 | return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); | 112 | return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); |
113 | } | 113 | } |
@@ -2131,71 +2131,29 @@ static const struct file_operations gfs2_sbstats_fops = { | |||
2131 | .release = seq_release, | 2131 | .release = seq_release, |
2132 | }; | 2132 | }; |
2133 | 2133 | ||
2134 | int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) | 2134 | void gfs2_create_debugfs_file(struct gfs2_sbd *sdp) |
2135 | { | 2135 | { |
2136 | struct dentry *dent; | 2136 | sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root); |
2137 | |||
2138 | dent = debugfs_create_dir(sdp->sd_table_name, gfs2_root); | ||
2139 | if (IS_ERR_OR_NULL(dent)) | ||
2140 | goto fail; | ||
2141 | sdp->debugfs_dir = dent; | ||
2142 | |||
2143 | dent = debugfs_create_file("glocks", | ||
2144 | S_IFREG | S_IRUGO, | ||
2145 | sdp->debugfs_dir, sdp, | ||
2146 | &gfs2_glocks_fops); | ||
2147 | if (IS_ERR_OR_NULL(dent)) | ||
2148 | goto fail; | ||
2149 | sdp->debugfs_dentry_glocks = dent; | ||
2150 | |||
2151 | dent = debugfs_create_file("glstats", | ||
2152 | S_IFREG | S_IRUGO, | ||
2153 | sdp->debugfs_dir, sdp, | ||
2154 | &gfs2_glstats_fops); | ||
2155 | if (IS_ERR_OR_NULL(dent)) | ||
2156 | goto fail; | ||
2157 | sdp->debugfs_dentry_glstats = dent; | ||
2158 | |||
2159 | dent = debugfs_create_file("sbstats", | ||
2160 | S_IFREG | S_IRUGO, | ||
2161 | sdp->debugfs_dir, sdp, | ||
2162 | &gfs2_sbstats_fops); | ||
2163 | if (IS_ERR_OR_NULL(dent)) | ||
2164 | goto fail; | ||
2165 | sdp->debugfs_dentry_sbstats = dent; | ||
2166 | 2137 | ||
2167 | return 0; | 2138 | debugfs_create_file("glocks", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp, |
2168 | fail: | 2139 | &gfs2_glocks_fops); |
2169 | gfs2_delete_debugfs_file(sdp); | 2140 | |
2170 | return dent ? PTR_ERR(dent) : -ENOMEM; | 2141 | debugfs_create_file("glstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp, |
2142 | &gfs2_glstats_fops); | ||
2143 | |||
2144 | debugfs_create_file("sbstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp, | ||
2145 | &gfs2_sbstats_fops); | ||
2171 | } | 2146 | } |
2172 | 2147 | ||
2173 | void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp) | 2148 | void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp) |
2174 | { | 2149 | { |
2175 | if (sdp->debugfs_dir) { | 2150 | debugfs_remove_recursive(sdp->debugfs_dir); |
2176 | if (sdp->debugfs_dentry_glocks) { | 2151 | sdp->debugfs_dir = NULL; |
2177 | debugfs_remove(sdp->debugfs_dentry_glocks); | ||
2178 | sdp->debugfs_dentry_glocks = NULL; | ||
2179 | } | ||
2180 | if (sdp->debugfs_dentry_glstats) { | ||
2181 | debugfs_remove(sdp->debugfs_dentry_glstats); | ||
2182 | sdp->debugfs_dentry_glstats = NULL; | ||
2183 | } | ||
2184 | if (sdp->debugfs_dentry_sbstats) { | ||
2185 | debugfs_remove(sdp->debugfs_dentry_sbstats); | ||
2186 | sdp->debugfs_dentry_sbstats = NULL; | ||
2187 | } | ||
2188 | debugfs_remove(sdp->debugfs_dir); | ||
2189 | sdp->debugfs_dir = NULL; | ||
2190 | } | ||
2191 | } | 2152 | } |
2192 | 2153 | ||
2193 | int gfs2_register_debugfs(void) | 2154 | void gfs2_register_debugfs(void) |
2194 | { | 2155 | { |
2195 | gfs2_root = debugfs_create_dir("gfs2", NULL); | 2156 | gfs2_root = debugfs_create_dir("gfs2", NULL); |
2196 | if (IS_ERR(gfs2_root)) | ||
2197 | return PTR_ERR(gfs2_root); | ||
2198 | return gfs2_root ? 0 : -ENOMEM; | ||
2199 | } | 2157 | } |
2200 | 2158 | ||
2201 | void gfs2_unregister_debugfs(void) | 2159 | 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); | |||
243 | extern int __init gfs2_glock_init(void); | 243 | extern int __init gfs2_glock_init(void); |
244 | extern void gfs2_glock_exit(void); | 244 | extern void gfs2_glock_exit(void); |
245 | 245 | ||
246 | extern int gfs2_create_debugfs_file(struct gfs2_sbd *sdp); | 246 | extern void gfs2_create_debugfs_file(struct gfs2_sbd *sdp); |
247 | extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp); | 247 | extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp); |
248 | extern int gfs2_register_debugfs(void); | 248 | extern void gfs2_register_debugfs(void); |
249 | extern void gfs2_unregister_debugfs(void); | 249 | extern void gfs2_unregister_debugfs(void); |
250 | 250 | ||
251 | extern const struct lm_lockops gfs2_dlm_ops; | 251 | 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 { | |||
853 | 853 | ||
854 | unsigned long sd_last_warning; | 854 | unsigned long sd_last_warning; |
855 | struct dentry *debugfs_dir; /* debugfs directory */ | 855 | struct dentry *debugfs_dir; /* debugfs directory */ |
856 | struct dentry *debugfs_dentry_glocks; | ||
857 | struct dentry *debugfs_dentry_glstats; | ||
858 | struct dentry *debugfs_dentry_sbstats; | ||
859 | }; | 856 | }; |
860 | 857 | ||
861 | static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which) | 858 | static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which) |
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) | |||
59 | 59 | ||
60 | static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change) | 60 | static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change) |
61 | { | 61 | { |
62 | gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change)); | 62 | change <<= inode->i_blkbits - GFS2_BASIC_BLOCK_SHIFT; |
63 | change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK); | 63 | gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks >= -change)); |
64 | inode->i_blocks += change; | 64 | inode->i_blocks += change; |
65 | } | 65 | } |
66 | 66 | ||
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) | |||
178 | if (!gfs2_page_pool) | 178 | if (!gfs2_page_pool) |
179 | goto fail_mempool; | 179 | goto fail_mempool; |
180 | 180 | ||
181 | error = gfs2_register_debugfs(); | 181 | gfs2_register_debugfs(); |
182 | if (error) | ||
183 | goto fail_debugfs; | ||
184 | 182 | ||
185 | pr_info("GFS2 installed\n"); | 183 | pr_info("GFS2 installed\n"); |
186 | 184 | ||
187 | return 0; | 185 | return 0; |
188 | 186 | ||
189 | fail_debugfs: | ||
190 | mempool_destroy(gfs2_page_pool); | ||
191 | fail_mempool: | 187 | fail_mempool: |
192 | destroy_workqueue(gfs2_freeze_wq); | 188 | destroy_workqueue(gfs2_freeze_wq); |
193 | fail_wq3: | 189 | fail_wq3: |