diff options
Diffstat (limited to 'fs/hpfs/namei.c')
-rw-r--r-- | fs/hpfs/namei.c | 49 |
1 files changed, 24 insertions, 25 deletions
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 | ||