diff options
Diffstat (limited to 'fs/hpfs')
-rw-r--r-- | fs/hpfs/Kconfig | 2 | ||||
-rw-r--r-- | fs/hpfs/dir.c | 23 | ||||
-rw-r--r-- | fs/hpfs/file.c | 9 | ||||
-rw-r--r-- | fs/hpfs/hpfs_fn.h | 22 | ||||
-rw-r--r-- | fs/hpfs/inode.c | 9 | ||||
-rw-r--r-- | fs/hpfs/namei.c | 49 | ||||
-rw-r--r-- | fs/hpfs/super.c | 23 |
7 files changed, 75 insertions, 62 deletions
diff --git a/fs/hpfs/Kconfig b/fs/hpfs/Kconfig index 63b6f5632318..0c39dc3ef7d7 100644 --- a/fs/hpfs/Kconfig +++ b/fs/hpfs/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config HPFS_FS | 1 | config HPFS_FS |
2 | tristate "OS/2 HPFS file system support" | 2 | tristate "OS/2 HPFS file system support" |
3 | depends on BLOCK | 3 | depends on BLOCK |
4 | depends on BKL # nontrivial to fix | 4 | depends on BROKEN || !PREEMPT |
5 | help | 5 | help |
6 | OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS | 6 | OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS |
7 | is the file system used for organizing files on OS/2 hard disk | 7 | is the file system used for organizing files on OS/2 hard disk |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index d32f63a569f7..b3d7c0ddb609 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -6,16 +6,15 @@ | |||
6 | * directory VFS functions | 6 | * directory VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
11 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
12 | 11 | ||
13 | static int hpfs_dir_release(struct inode *inode, struct file *filp) | 12 | static int hpfs_dir_release(struct inode *inode, struct file *filp) |
14 | { | 13 | { |
15 | lock_kernel(); | 14 | hpfs_lock(inode->i_sb); |
16 | hpfs_del_pos(inode, &filp->f_pos); | 15 | hpfs_del_pos(inode, &filp->f_pos); |
17 | /*hpfs_write_if_changed(inode);*/ | 16 | /*hpfs_write_if_changed(inode);*/ |
18 | unlock_kernel(); | 17 | hpfs_unlock(inode->i_sb); |
19 | return 0; | 18 | return 0; |
20 | } | 19 | } |
21 | 20 | ||
@@ -30,7 +29,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
30 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); | 29 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); |
31 | struct super_block *s = i->i_sb; | 30 | struct super_block *s = i->i_sb; |
32 | 31 | ||
33 | lock_kernel(); | 32 | hpfs_lock(s); |
34 | 33 | ||
35 | /*printk("dir lseek\n");*/ | 34 | /*printk("dir lseek\n");*/ |
36 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; | 35 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; |
@@ -43,12 +42,12 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
43 | } | 42 | } |
44 | mutex_unlock(&i->i_mutex); | 43 | mutex_unlock(&i->i_mutex); |
45 | ok: | 44 | ok: |
46 | unlock_kernel(); | 45 | hpfs_unlock(s); |
47 | return filp->f_pos = new_off; | 46 | return filp->f_pos = new_off; |
48 | fail: | 47 | fail: |
49 | mutex_unlock(&i->i_mutex); | 48 | mutex_unlock(&i->i_mutex); |
50 | /*printk("illegal lseek: %016llx\n", new_off);*/ | 49 | /*printk("illegal lseek: %016llx\n", new_off);*/ |
51 | unlock_kernel(); | 50 | hpfs_unlock(s); |
52 | return -ESPIPE; | 51 | return -ESPIPE; |
53 | } | 52 | } |
54 | 53 | ||
@@ -64,7 +63,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
64 | int c1, c2 = 0; | 63 | int c1, c2 = 0; |
65 | int ret = 0; | 64 | int ret = 0; |
66 | 65 | ||
67 | lock_kernel(); | 66 | hpfs_lock(inode->i_sb); |
68 | 67 | ||
69 | if (hpfs_sb(inode->i_sb)->sb_chk) { | 68 | if (hpfs_sb(inode->i_sb)->sb_chk) { |
70 | if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { | 69 | if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { |
@@ -167,7 +166,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
167 | hpfs_brelse4(&qbh); | 166 | hpfs_brelse4(&qbh); |
168 | } | 167 | } |
169 | out: | 168 | out: |
170 | unlock_kernel(); | 169 | hpfs_unlock(inode->i_sb); |
171 | return ret; | 170 | return ret; |
172 | } | 171 | } |
173 | 172 | ||
@@ -197,10 +196,10 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
197 | struct inode *result = NULL; | 196 | struct inode *result = NULL; |
198 | struct hpfs_inode_info *hpfs_result; | 197 | struct hpfs_inode_info *hpfs_result; |
199 | 198 | ||
200 | lock_kernel(); | 199 | hpfs_lock(dir->i_sb); |
201 | if ((err = hpfs_chk_name(name, &len))) { | 200 | if ((err = hpfs_chk_name(name, &len))) { |
202 | if (err == -ENAMETOOLONG) { | 201 | if (err == -ENAMETOOLONG) { |
203 | unlock_kernel(); | 202 | hpfs_unlock(dir->i_sb); |
204 | return ERR_PTR(-ENAMETOOLONG); | 203 | return ERR_PTR(-ENAMETOOLONG); |
205 | } | 204 | } |
206 | goto end_add; | 205 | goto end_add; |
@@ -298,7 +297,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
298 | 297 | ||
299 | end: | 298 | end: |
300 | end_add: | 299 | end_add: |
301 | unlock_kernel(); | 300 | hpfs_unlock(dir->i_sb); |
302 | d_add(dentry, result); | 301 | d_add(dentry, result); |
303 | return NULL; | 302 | return NULL; |
304 | 303 | ||
@@ -311,7 +310,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
311 | 310 | ||
312 | /*bail:*/ | 311 | /*bail:*/ |
313 | 312 | ||
314 | unlock_kernel(); | 313 | hpfs_unlock(dir->i_sb); |
315 | return ERR_PTR(-ENOENT); | 314 | return ERR_PTR(-ENOENT); |
316 | } | 315 | } |
317 | 316 | ||
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 9e84257b3ad5..9b9eb6933e43 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -6,16 +6,15 @@ | |||
6 | * file VFS functions | 6 | * file VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include "hpfs_fn.h" | 9 | #include "hpfs_fn.h" |
11 | 10 | ||
12 | #define BLOCKS(size) (((size) + 511) >> 9) | 11 | #define BLOCKS(size) (((size) + 511) >> 9) |
13 | 12 | ||
14 | static int hpfs_file_release(struct inode *inode, struct file *file) | 13 | static int hpfs_file_release(struct inode *inode, struct file *file) |
15 | { | 14 | { |
16 | lock_kernel(); | 15 | hpfs_lock(inode->i_sb); |
17 | hpfs_write_if_changed(inode); | 16 | hpfs_write_if_changed(inode); |
18 | unlock_kernel(); | 17 | hpfs_unlock(inode->i_sb); |
19 | return 0; | 18 | return 0; |
20 | } | 19 | } |
21 | 20 | ||
@@ -49,14 +48,14 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno) | |||
49 | static void hpfs_truncate(struct inode *i) | 48 | static void hpfs_truncate(struct inode *i) |
50 | { | 49 | { |
51 | if (IS_IMMUTABLE(i)) return /*-EPERM*/; | 50 | if (IS_IMMUTABLE(i)) return /*-EPERM*/; |
52 | lock_kernel(); | 51 | hpfs_lock(i->i_sb); |
53 | hpfs_i(i)->i_n_secs = 0; | 52 | hpfs_i(i)->i_n_secs = 0; |
54 | i->i_blocks = 1 + ((i->i_size + 511) >> 9); | 53 | i->i_blocks = 1 + ((i->i_size + 511) >> 9); |
55 | hpfs_i(i)->mmu_private = i->i_size; | 54 | hpfs_i(i)->mmu_private = i->i_size; |
56 | hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9)); | 55 | hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9)); |
57 | hpfs_write_inode(i); | 56 | hpfs_write_inode(i); |
58 | hpfs_i(i)->i_n_secs = 0; | 57 | hpfs_i(i)->i_n_secs = 0; |
59 | unlock_kernel(); | 58 | hpfs_unlock(i->i_sb); |
60 | } | 59 | } |
61 | 60 | ||
62 | static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) | 61 | static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 1c43dbea55e8..c15adbca07ff 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -342,3 +342,25 @@ static inline time32_t gmt_to_local(struct super_block *s, time_t t) | |||
342 | extern struct timezone sys_tz; | 342 | extern struct timezone sys_tz; |
343 | return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; | 343 | return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; |
344 | } | 344 | } |
345 | |||
346 | /* | ||
347 | * Locking: | ||
348 | * | ||
349 | * hpfs_lock() is a leftover from the big kernel lock. | ||
350 | * Right now, these functions are empty and only left | ||
351 | * for documentation purposes. The file system no longer | ||
352 | * works on SMP systems, so the lock is not needed | ||
353 | * any more. | ||
354 | * | ||
355 | * If someone is interested in making it work again, this | ||
356 | * would be the place to start by adding a per-superblock | ||
357 | * mutex and fixing all the bugs and performance issues | ||
358 | * caused by that. | ||
359 | */ | ||
360 | static inline void hpfs_lock(struct super_block *s) | ||
361 | { | ||
362 | } | ||
363 | |||
364 | static inline void hpfs_unlock(struct super_block *s) | ||
365 | { | ||
366 | } | ||
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 1ae35baa539e..87f1f787e767 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * inode VFS functions | 6 | * inode VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
11 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
12 | 11 | ||
@@ -267,7 +266,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
267 | struct inode *inode = dentry->d_inode; | 266 | struct inode *inode = dentry->d_inode; |
268 | int error = -EINVAL; | 267 | int error = -EINVAL; |
269 | 268 | ||
270 | lock_kernel(); | 269 | hpfs_lock(inode->i_sb); |
271 | if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) | 270 | if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) |
272 | goto out_unlock; | 271 | goto out_unlock; |
273 | if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) | 272 | if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) |
@@ -290,7 +289,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
290 | hpfs_write_inode(inode); | 289 | hpfs_write_inode(inode); |
291 | 290 | ||
292 | out_unlock: | 291 | out_unlock: |
293 | unlock_kernel(); | 292 | hpfs_unlock(inode->i_sb); |
294 | return error; | 293 | return error; |
295 | } | 294 | } |
296 | 295 | ||
@@ -307,8 +306,8 @@ void hpfs_evict_inode(struct inode *inode) | |||
307 | truncate_inode_pages(&inode->i_data, 0); | 306 | truncate_inode_pages(&inode->i_data, 0); |
308 | end_writeback(inode); | 307 | end_writeback(inode); |
309 | if (!inode->i_nlink) { | 308 | if (!inode->i_nlink) { |
310 | lock_kernel(); | 309 | hpfs_lock(inode->i_sb); |
311 | hpfs_remove_fnode(inode->i_sb, inode->i_ino); | 310 | hpfs_remove_fnode(inode->i_sb, inode->i_ino); |
312 | unlock_kernel(); | 311 | hpfs_unlock(inode->i_sb); |
313 | } | 312 | } |
314 | } | 313 | } |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index f4ad9e31ddc4..d5f8c8a19023 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * adding & removing files & directories | 6 | * adding & removing files & directories |
7 | */ | 7 | */ |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/smp_lock.h> | ||
10 | #include "hpfs_fn.h" | 9 | #include "hpfs_fn.h" |
11 | 10 | ||
12 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 11 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
@@ -25,7 +24,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
25 | struct hpfs_dirent dee; | 24 | struct hpfs_dirent dee; |
26 | int err; | 25 | int err; |
27 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; | 26 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; |
28 | lock_kernel(); | 27 | hpfs_lock(dir->i_sb); |
29 | err = -ENOSPC; | 28 | err = -ENOSPC; |
30 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); | 29 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); |
31 | if (!fnode) | 30 | if (!fnode) |
@@ -103,7 +102,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
103 | } | 102 | } |
104 | d_instantiate(dentry, result); | 103 | d_instantiate(dentry, result); |
105 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 104 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
106 | unlock_kernel(); | 105 | hpfs_unlock(dir->i_sb); |
107 | return 0; | 106 | return 0; |
108 | bail3: | 107 | bail3: |
109 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 108 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
@@ -115,7 +114,7 @@ bail1: | |||
115 | brelse(bh); | 114 | brelse(bh); |
116 | hpfs_free_sectors(dir->i_sb, fno, 1); | 115 | hpfs_free_sectors(dir->i_sb, fno, 1); |
117 | bail: | 116 | bail: |
118 | unlock_kernel(); | 117 | hpfs_unlock(dir->i_sb); |
119 | return err; | 118 | return err; |
120 | } | 119 | } |
121 | 120 | ||
@@ -132,7 +131,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
132 | int err; | 131 | int err; |
133 | if ((err = hpfs_chk_name(name, &len))) | 132 | if ((err = hpfs_chk_name(name, &len))) |
134 | return err==-ENOENT ? -EINVAL : err; | 133 | return err==-ENOENT ? -EINVAL : err; |
135 | lock_kernel(); | 134 | hpfs_lock(dir->i_sb); |
136 | err = -ENOSPC; | 135 | err = -ENOSPC; |
137 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); | 136 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); |
138 | if (!fnode) | 137 | if (!fnode) |
@@ -195,7 +194,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
195 | } | 194 | } |
196 | d_instantiate(dentry, result); | 195 | d_instantiate(dentry, result); |
197 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 196 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
198 | unlock_kernel(); | 197 | hpfs_unlock(dir->i_sb); |
199 | return 0; | 198 | return 0; |
200 | 199 | ||
201 | bail2: | 200 | bail2: |
@@ -205,7 +204,7 @@ bail1: | |||
205 | brelse(bh); | 204 | brelse(bh); |
206 | hpfs_free_sectors(dir->i_sb, fno, 1); | 205 | hpfs_free_sectors(dir->i_sb, fno, 1); |
207 | bail: | 206 | bail: |
208 | unlock_kernel(); | 207 | hpfs_unlock(dir->i_sb); |
209 | return err; | 208 | return err; |
210 | } | 209 | } |
211 | 210 | ||
@@ -224,7 +223,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
224 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM; | 223 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM; |
225 | if (!new_valid_dev(rdev)) | 224 | if (!new_valid_dev(rdev)) |
226 | return -EINVAL; | 225 | return -EINVAL; |
227 | lock_kernel(); | 226 | hpfs_lock(dir->i_sb); |
228 | err = -ENOSPC; | 227 | err = -ENOSPC; |
229 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); | 228 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); |
230 | if (!fnode) | 229 | if (!fnode) |
@@ -274,7 +273,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
274 | d_instantiate(dentry, result); | 273 | d_instantiate(dentry, result); |
275 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 274 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
276 | brelse(bh); | 275 | brelse(bh); |
277 | unlock_kernel(); | 276 | hpfs_unlock(dir->i_sb); |
278 | return 0; | 277 | return 0; |
279 | bail2: | 278 | bail2: |
280 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 279 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
@@ -283,7 +282,7 @@ bail1: | |||
283 | brelse(bh); | 282 | brelse(bh); |
284 | hpfs_free_sectors(dir->i_sb, fno, 1); | 283 | hpfs_free_sectors(dir->i_sb, fno, 1); |
285 | bail: | 284 | bail: |
286 | unlock_kernel(); | 285 | hpfs_unlock(dir->i_sb); |
287 | return err; | 286 | return err; |
288 | } | 287 | } |
289 | 288 | ||
@@ -299,9 +298,9 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
299 | struct inode *result; | 298 | struct inode *result; |
300 | int err; | 299 | int err; |
301 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; | 300 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; |
302 | lock_kernel(); | 301 | hpfs_lock(dir->i_sb); |
303 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) { | 302 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) { |
304 | unlock_kernel(); | 303 | hpfs_unlock(dir->i_sb); |
305 | return -EPERM; | 304 | return -EPERM; |
306 | } | 305 | } |
307 | err = -ENOSPC; | 306 | err = -ENOSPC; |
@@ -354,7 +353,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
354 | hpfs_write_inode_nolock(result); | 353 | hpfs_write_inode_nolock(result); |
355 | d_instantiate(dentry, result); | 354 | d_instantiate(dentry, result); |
356 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 355 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
357 | unlock_kernel(); | 356 | hpfs_unlock(dir->i_sb); |
358 | return 0; | 357 | return 0; |
359 | bail2: | 358 | bail2: |
360 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 359 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
@@ -363,7 +362,7 @@ bail1: | |||
363 | brelse(bh); | 362 | brelse(bh); |
364 | hpfs_free_sectors(dir->i_sb, fno, 1); | 363 | hpfs_free_sectors(dir->i_sb, fno, 1); |
365 | bail: | 364 | bail: |
366 | unlock_kernel(); | 365 | hpfs_unlock(dir->i_sb); |
367 | return err; | 366 | return err; |
368 | } | 367 | } |
369 | 368 | ||
@@ -380,7 +379,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | |||
380 | int rep = 0; | 379 | int rep = 0; |
381 | int err; | 380 | int err; |
382 | 381 | ||
383 | lock_kernel(); | 382 | hpfs_lock(dir->i_sb); |
384 | hpfs_adjust_length(name, &len); | 383 | hpfs_adjust_length(name, &len); |
385 | again: | 384 | again: |
386 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | 385 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); |
@@ -416,7 +415,7 @@ again: | |||
416 | dentry_unhash(dentry); | 415 | dentry_unhash(dentry); |
417 | if (!d_unhashed(dentry)) { | 416 | if (!d_unhashed(dentry)) { |
418 | dput(dentry); | 417 | dput(dentry); |
419 | unlock_kernel(); | 418 | hpfs_unlock(dir->i_sb); |
420 | return -ENOSPC; | 419 | return -ENOSPC; |
421 | } | 420 | } |
422 | if (generic_permission(inode, MAY_WRITE, 0, NULL) || | 421 | if (generic_permission(inode, MAY_WRITE, 0, NULL) || |
@@ -435,7 +434,7 @@ again: | |||
435 | if (!err) | 434 | if (!err) |
436 | goto again; | 435 | goto again; |
437 | } | 436 | } |
438 | unlock_kernel(); | 437 | hpfs_unlock(dir->i_sb); |
439 | return -ENOSPC; | 438 | return -ENOSPC; |
440 | default: | 439 | default: |
441 | drop_nlink(inode); | 440 | drop_nlink(inode); |
@@ -448,7 +447,7 @@ out1: | |||
448 | out: | 447 | out: |
449 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 448 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
450 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | 449 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); |
451 | unlock_kernel(); | 450 | hpfs_unlock(dir->i_sb); |
452 | return err; | 451 | return err; |
453 | } | 452 | } |
454 | 453 | ||
@@ -466,7 +465,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
466 | int r; | 465 | int r; |
467 | 466 | ||
468 | hpfs_adjust_length(name, &len); | 467 | hpfs_adjust_length(name, &len); |
469 | lock_kernel(); | 468 | hpfs_lock(dir->i_sb); |
470 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | 469 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); |
471 | mutex_lock(&hpfs_i(dir)->i_mutex); | 470 | mutex_lock(&hpfs_i(dir)->i_mutex); |
472 | err = -ENOENT; | 471 | err = -ENOENT; |
@@ -508,7 +507,7 @@ out1: | |||
508 | out: | 507 | out: |
509 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 508 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
510 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | 509 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); |
511 | unlock_kernel(); | 510 | hpfs_unlock(dir->i_sb); |
512 | return err; | 511 | return err; |
513 | } | 512 | } |
514 | 513 | ||
@@ -521,21 +520,21 @@ static int hpfs_symlink_readpage(struct file *file, struct page *page) | |||
521 | int err; | 520 | int err; |
522 | 521 | ||
523 | err = -EIO; | 522 | err = -EIO; |
524 | lock_kernel(); | 523 | hpfs_lock(i->i_sb); |
525 | if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) | 524 | if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) |
526 | goto fail; | 525 | goto fail; |
527 | err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE); | 526 | err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE); |
528 | brelse(bh); | 527 | brelse(bh); |
529 | if (err) | 528 | if (err) |
530 | goto fail; | 529 | goto fail; |
531 | unlock_kernel(); | 530 | hpfs_unlock(i->i_sb); |
532 | SetPageUptodate(page); | 531 | SetPageUptodate(page); |
533 | kunmap(page); | 532 | kunmap(page); |
534 | unlock_page(page); | 533 | unlock_page(page); |
535 | return 0; | 534 | return 0; |
536 | 535 | ||
537 | fail: | 536 | fail: |
538 | unlock_kernel(); | 537 | hpfs_unlock(i->i_sb); |
539 | SetPageError(page); | 538 | SetPageError(page); |
540 | kunmap(page); | 539 | kunmap(page); |
541 | unlock_page(page); | 540 | unlock_page(page); |
@@ -567,7 +566,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
567 | err = 0; | 566 | err = 0; |
568 | hpfs_adjust_length(old_name, &old_len); | 567 | hpfs_adjust_length(old_name, &old_len); |
569 | 568 | ||
570 | lock_kernel(); | 569 | hpfs_lock(i->i_sb); |
571 | /* order doesn't matter, due to VFS exclusion */ | 570 | /* order doesn't matter, due to VFS exclusion */ |
572 | mutex_lock(&hpfs_i(i)->i_parent_mutex); | 571 | mutex_lock(&hpfs_i(i)->i_parent_mutex); |
573 | if (new_inode) | 572 | if (new_inode) |
@@ -659,7 +658,7 @@ end1: | |||
659 | mutex_unlock(&hpfs_i(i)->i_parent_mutex); | 658 | mutex_unlock(&hpfs_i(i)->i_parent_mutex); |
660 | if (new_inode) | 659 | if (new_inode) |
661 | mutex_unlock(&hpfs_i(new_inode)->i_parent_mutex); | 660 | mutex_unlock(&hpfs_i(new_inode)->i_parent_mutex); |
662 | unlock_kernel(); | 661 | hpfs_unlock(i->i_sb); |
663 | return err; | 662 | return err; |
664 | } | 663 | } |
665 | 664 | ||
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index b30426b1fc97..c89b40808587 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/statfs.h> | 13 | #include <linux/statfs.h> |
14 | #include <linux/magic.h> | 14 | #include <linux/magic.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/bitmap.h> | 16 | #include <linux/bitmap.h> |
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | 18 | ||
@@ -103,15 +102,11 @@ static void hpfs_put_super(struct super_block *s) | |||
103 | { | 102 | { |
104 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 103 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
105 | 104 | ||
106 | lock_kernel(); | ||
107 | |||
108 | kfree(sbi->sb_cp_table); | 105 | kfree(sbi->sb_cp_table); |
109 | kfree(sbi->sb_bmp_dir); | 106 | kfree(sbi->sb_bmp_dir); |
110 | unmark_dirty(s); | 107 | unmark_dirty(s); |
111 | s->s_fs_info = NULL; | 108 | s->s_fs_info = NULL; |
112 | kfree(sbi); | 109 | kfree(sbi); |
113 | |||
114 | unlock_kernel(); | ||
115 | } | 110 | } |
116 | 111 | ||
117 | unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) | 112 | unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) |
@@ -143,7 +138,7 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
143 | struct super_block *s = dentry->d_sb; | 138 | struct super_block *s = dentry->d_sb; |
144 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 139 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
145 | u64 id = huge_encode_dev(s->s_bdev->bd_dev); | 140 | u64 id = huge_encode_dev(s->s_bdev->bd_dev); |
146 | lock_kernel(); | 141 | hpfs_lock(s); |
147 | 142 | ||
148 | /*if (sbi->sb_n_free == -1) {*/ | 143 | /*if (sbi->sb_n_free == -1) {*/ |
149 | sbi->sb_n_free = count_bitmaps(s); | 144 | sbi->sb_n_free = count_bitmaps(s); |
@@ -160,7 +155,7 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
160 | buf->f_fsid.val[1] = (u32)(id >> 32); | 155 | buf->f_fsid.val[1] = (u32)(id >> 32); |
161 | buf->f_namelen = 254; | 156 | buf->f_namelen = 254; |
162 | 157 | ||
163 | unlock_kernel(); | 158 | hpfs_unlock(s); |
164 | 159 | ||
165 | return 0; | 160 | return 0; |
166 | } | 161 | } |
@@ -406,7 +401,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
406 | 401 | ||
407 | *flags |= MS_NOATIME; | 402 | *flags |= MS_NOATIME; |
408 | 403 | ||
409 | lock_kernel(); | 404 | hpfs_lock(s); |
410 | lock_super(s); | 405 | lock_super(s); |
411 | uid = sbi->sb_uid; gid = sbi->sb_gid; | 406 | uid = sbi->sb_uid; gid = sbi->sb_gid; |
412 | umask = 0777 & ~sbi->sb_mode; | 407 | umask = 0777 & ~sbi->sb_mode; |
@@ -441,12 +436,12 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
441 | replace_mount_options(s, new_opts); | 436 | replace_mount_options(s, new_opts); |
442 | 437 | ||
443 | unlock_super(s); | 438 | unlock_super(s); |
444 | unlock_kernel(); | 439 | hpfs_unlock(s); |
445 | return 0; | 440 | return 0; |
446 | 441 | ||
447 | out_err: | 442 | out_err: |
448 | unlock_super(s); | 443 | unlock_super(s); |
449 | unlock_kernel(); | 444 | hpfs_unlock(s); |
450 | kfree(new_opts); | 445 | kfree(new_opts); |
451 | return -EINVAL; | 446 | return -EINVAL; |
452 | } | 447 | } |
@@ -484,13 +479,15 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
484 | 479 | ||
485 | int o; | 480 | int o; |
486 | 481 | ||
487 | lock_kernel(); | 482 | if (num_possible_cpus() > 1) { |
483 | printk(KERN_ERR "HPFS is not SMP safe\n"); | ||
484 | return -EINVAL; | ||
485 | } | ||
488 | 486 | ||
489 | save_mount_options(s, options); | 487 | save_mount_options(s, options); |
490 | 488 | ||
491 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 489 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
492 | if (!sbi) { | 490 | if (!sbi) { |
493 | unlock_kernel(); | ||
494 | return -ENOMEM; | 491 | return -ENOMEM; |
495 | } | 492 | } |
496 | s->s_fs_info = sbi; | 493 | s->s_fs_info = sbi; |
@@ -677,7 +674,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
677 | root->i_blocks = 5; | 674 | root->i_blocks = 5; |
678 | hpfs_brelse4(&qbh); | 675 | hpfs_brelse4(&qbh); |
679 | } | 676 | } |
680 | unlock_kernel(); | ||
681 | return 0; | 677 | return 0; |
682 | 678 | ||
683 | bail4: brelse(bh2); | 679 | bail4: brelse(bh2); |
@@ -689,7 +685,6 @@ bail0: | |||
689 | kfree(sbi->sb_cp_table); | 685 | kfree(sbi->sb_cp_table); |
690 | s->s_fs_info = NULL; | 686 | s->s_fs_info = NULL; |
691 | kfree(sbi); | 687 | kfree(sbi); |
692 | unlock_kernel(); | ||
693 | return -EINVAL; | 688 | return -EINVAL; |
694 | } | 689 | } |
695 | 690 | ||