diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-06-06 17:38:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-06 19:08:18 -0400 |
commit | 0244756edc4b98c129e92c7061d9f383708cf786 (patch) | |
tree | 49ff65c45d2ca48e184e1d931d79c122982461e1 | |
parent | 0d2b7ea9287d39e87531d233ba885263e6160127 (diff) |
ufs: sb mutex merge + mutex_destroy
Commit 788257d6101d ("ufs: remove the BKL") replaced BKL with mutex
protection using functions lock_ufs, unlock_ufs and struct mutex 'mutex'
in sb_info.
Commit b6963327e052 ("ufs: drop lock/unlock super") removed lock/unlock
super and added struct mutex 's_lock' in sb_info.
Those 2 mutexes are generally locked/unlocked at the same time except in
allocation (balloc, ialloc).
This patch merges the 2 mutexes and propagates first commit solution.
It also adds mutex destruction before kfree during ufs_fill_super
failure and ufs_put_super.
[akpm@linux-foundation.org: avoid ifdefs, return -EROFS not -EINVAL]
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: "Chen, Jet" <jet.chen@intel.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ufs/balloc.c | 30 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 17 | ||||
-rw-r--r-- | fs/ufs/super.c | 28 | ||||
-rw-r--r-- | fs/ufs/ufs.h | 1 |
4 files changed, 33 insertions, 43 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 184323cac1a4..7bc20809c99e 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -52,7 +52,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
52 | if (ufs_fragnum(fragment) + count > uspi->s_fpg) | 52 | if (ufs_fragnum(fragment) + count > uspi->s_fpg) |
53 | ufs_error (sb, "ufs_free_fragments", "internal error"); | 53 | ufs_error (sb, "ufs_free_fragments", "internal error"); |
54 | 54 | ||
55 | mutex_lock(&UFS_SB(sb)->s_lock); | 55 | lock_ufs(sb); |
56 | 56 | ||
57 | cgno = ufs_dtog(uspi, fragment); | 57 | cgno = ufs_dtog(uspi, fragment); |
58 | bit = ufs_dtogd(uspi, fragment); | 58 | bit = ufs_dtogd(uspi, fragment); |
@@ -116,12 +116,12 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
116 | ubh_sync_block(UCPI_UBH(ucpi)); | 116 | ubh_sync_block(UCPI_UBH(ucpi)); |
117 | ufs_mark_sb_dirty(sb); | 117 | ufs_mark_sb_dirty(sb); |
118 | 118 | ||
119 | mutex_unlock(&UFS_SB(sb)->s_lock); | 119 | unlock_ufs(sb); |
120 | UFSD("EXIT\n"); | 120 | UFSD("EXIT\n"); |
121 | return; | 121 | return; |
122 | 122 | ||
123 | failed: | 123 | failed: |
124 | mutex_unlock(&UFS_SB(sb)->s_lock); | 124 | unlock_ufs(sb); |
125 | UFSD("EXIT (FAILED)\n"); | 125 | UFSD("EXIT (FAILED)\n"); |
126 | return; | 126 | return; |
127 | } | 127 | } |
@@ -151,7 +151,7 @@ void ufs_free_blocks(struct inode *inode, u64 fragment, unsigned count) | |||
151 | goto failed; | 151 | goto failed; |
152 | } | 152 | } |
153 | 153 | ||
154 | mutex_lock(&UFS_SB(sb)->s_lock); | 154 | lock_ufs(sb); |
155 | 155 | ||
156 | do_more: | 156 | do_more: |
157 | overflow = 0; | 157 | overflow = 0; |
@@ -211,12 +211,12 @@ do_more: | |||
211 | } | 211 | } |
212 | 212 | ||
213 | ufs_mark_sb_dirty(sb); | 213 | ufs_mark_sb_dirty(sb); |
214 | mutex_unlock(&UFS_SB(sb)->s_lock); | 214 | unlock_ufs(sb); |
215 | UFSD("EXIT\n"); | 215 | UFSD("EXIT\n"); |
216 | return; | 216 | return; |
217 | 217 | ||
218 | failed_unlock: | 218 | failed_unlock: |
219 | mutex_unlock(&UFS_SB(sb)->s_lock); | 219 | unlock_ufs(sb); |
220 | failed: | 220 | failed: |
221 | UFSD("EXIT (FAILED)\n"); | 221 | UFSD("EXIT (FAILED)\n"); |
222 | return; | 222 | return; |
@@ -357,7 +357,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
357 | usb1 = ubh_get_usb_first(uspi); | 357 | usb1 = ubh_get_usb_first(uspi); |
358 | *err = -ENOSPC; | 358 | *err = -ENOSPC; |
359 | 359 | ||
360 | mutex_lock(&UFS_SB(sb)->s_lock); | 360 | lock_ufs(sb); |
361 | tmp = ufs_data_ptr_to_cpu(sb, p); | 361 | tmp = ufs_data_ptr_to_cpu(sb, p); |
362 | 362 | ||
363 | if (count + ufs_fragnum(fragment) > uspi->s_fpb) { | 363 | if (count + ufs_fragnum(fragment) > uspi->s_fpb) { |
@@ -378,19 +378,19 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
378 | "fragment %llu, tmp %llu\n", | 378 | "fragment %llu, tmp %llu\n", |
379 | (unsigned long long)fragment, | 379 | (unsigned long long)fragment, |
380 | (unsigned long long)tmp); | 380 | (unsigned long long)tmp); |
381 | mutex_unlock(&UFS_SB(sb)->s_lock); | 381 | unlock_ufs(sb); |
382 | return INVBLOCK; | 382 | return INVBLOCK; |
383 | } | 383 | } |
384 | if (fragment < UFS_I(inode)->i_lastfrag) { | 384 | if (fragment < UFS_I(inode)->i_lastfrag) { |
385 | UFSD("EXIT (ALREADY ALLOCATED)\n"); | 385 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
386 | mutex_unlock(&UFS_SB(sb)->s_lock); | 386 | unlock_ufs(sb); |
387 | return 0; | 387 | return 0; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | else { | 390 | else { |
391 | if (tmp) { | 391 | if (tmp) { |
392 | UFSD("EXIT (ALREADY ALLOCATED)\n"); | 392 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
393 | mutex_unlock(&UFS_SB(sb)->s_lock); | 393 | unlock_ufs(sb); |
394 | return 0; | 394 | return 0; |
395 | } | 395 | } |
396 | } | 396 | } |
@@ -399,7 +399,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
399 | * There is not enough space for user on the device | 399 | * There is not enough space for user on the device |
400 | */ | 400 | */ |
401 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { | 401 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { |
402 | mutex_unlock(&UFS_SB(sb)->s_lock); | 402 | unlock_ufs(sb); |
403 | UFSD("EXIT (FAILED)\n"); | 403 | UFSD("EXIT (FAILED)\n"); |
404 | return 0; | 404 | return 0; |
405 | } | 405 | } |
@@ -424,7 +424,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
424 | ufs_clear_frags(inode, result + oldcount, | 424 | ufs_clear_frags(inode, result + oldcount, |
425 | newcount - oldcount, locked_page != NULL); | 425 | newcount - oldcount, locked_page != NULL); |
426 | } | 426 | } |
427 | mutex_unlock(&UFS_SB(sb)->s_lock); | 427 | unlock_ufs(sb); |
428 | UFSD("EXIT, result %llu\n", (unsigned long long)result); | 428 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
429 | return result; | 429 | return result; |
430 | } | 430 | } |
@@ -439,7 +439,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
439 | fragment + count); | 439 | fragment + count); |
440 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, | 440 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
441 | locked_page != NULL); | 441 | locked_page != NULL); |
442 | mutex_unlock(&UFS_SB(sb)->s_lock); | 442 | unlock_ufs(sb); |
443 | UFSD("EXIT, result %llu\n", (unsigned long long)result); | 443 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
444 | return result; | 444 | return result; |
445 | } | 445 | } |
@@ -477,7 +477,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
477 | *err = 0; | 477 | *err = 0; |
478 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, | 478 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
479 | fragment + count); | 479 | fragment + count); |
480 | mutex_unlock(&UFS_SB(sb)->s_lock); | 480 | unlock_ufs(sb); |
481 | if (newcount < request) | 481 | if (newcount < request) |
482 | ufs_free_fragments (inode, result + newcount, request - newcount); | 482 | ufs_free_fragments (inode, result + newcount, request - newcount); |
483 | ufs_free_fragments (inode, tmp, oldcount); | 483 | ufs_free_fragments (inode, tmp, oldcount); |
@@ -485,7 +485,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
485 | return result; | 485 | return result; |
486 | } | 486 | } |
487 | 487 | ||
488 | mutex_unlock(&UFS_SB(sb)->s_lock); | 488 | unlock_ufs(sb); |
489 | UFSD("EXIT (FAILED)\n"); | 489 | UFSD("EXIT (FAILED)\n"); |
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 98f7211599ff..a9cc75ffa925 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -69,11 +69,11 @@ void ufs_free_inode (struct inode * inode) | |||
69 | 69 | ||
70 | ino = inode->i_ino; | 70 | ino = inode->i_ino; |
71 | 71 | ||
72 | mutex_lock(&UFS_SB(sb)->s_lock); | 72 | lock_ufs(sb); |
73 | 73 | ||
74 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { | 74 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { |
75 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); | 75 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); |
76 | mutex_unlock(&UFS_SB(sb)->s_lock); | 76 | unlock_ufs(sb); |
77 | return; | 77 | return; |
78 | } | 78 | } |
79 | 79 | ||
@@ -81,7 +81,7 @@ void ufs_free_inode (struct inode * inode) | |||
81 | bit = ufs_inotocgoff (ino); | 81 | bit = ufs_inotocgoff (ino); |
82 | ucpi = ufs_load_cylinder (sb, cg); | 82 | ucpi = ufs_load_cylinder (sb, cg); |
83 | if (!ucpi) { | 83 | if (!ucpi) { |
84 | mutex_unlock(&UFS_SB(sb)->s_lock); | 84 | unlock_ufs(sb); |
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); | 87 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
@@ -115,7 +115,7 @@ void ufs_free_inode (struct inode * inode) | |||
115 | ubh_sync_block(UCPI_UBH(ucpi)); | 115 | ubh_sync_block(UCPI_UBH(ucpi)); |
116 | 116 | ||
117 | ufs_mark_sb_dirty(sb); | 117 | ufs_mark_sb_dirty(sb); |
118 | mutex_unlock(&UFS_SB(sb)->s_lock); | 118 | unlock_ufs(sb); |
119 | UFSD("EXIT\n"); | 119 | UFSD("EXIT\n"); |
120 | } | 120 | } |
121 | 121 | ||
@@ -193,7 +193,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode) | |||
193 | sbi = UFS_SB(sb); | 193 | sbi = UFS_SB(sb); |
194 | uspi = sbi->s_uspi; | 194 | uspi = sbi->s_uspi; |
195 | 195 | ||
196 | mutex_lock(&sbi->s_lock); | 196 | lock_ufs(sb); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Try to place the inode in its parent directory | 199 | * Try to place the inode in its parent directory |
@@ -328,21 +328,20 @@ cg_found: | |||
328 | sync_dirty_buffer(bh); | 328 | sync_dirty_buffer(bh); |
329 | brelse(bh); | 329 | brelse(bh); |
330 | } | 330 | } |
331 | 331 | unlock_ufs(sb); | |
332 | mutex_unlock(&sbi->s_lock); | ||
333 | 332 | ||
334 | UFSD("allocating inode %lu\n", inode->i_ino); | 333 | UFSD("allocating inode %lu\n", inode->i_ino); |
335 | UFSD("EXIT\n"); | 334 | UFSD("EXIT\n"); |
336 | return inode; | 335 | return inode; |
337 | 336 | ||
338 | fail_remove_inode: | 337 | fail_remove_inode: |
339 | mutex_unlock(&sbi->s_lock); | 338 | unlock_ufs(sb); |
340 | clear_nlink(inode); | 339 | clear_nlink(inode); |
341 | iput(inode); | 340 | iput(inode); |
342 | UFSD("EXIT (FAILED): err %d\n", err); | 341 | UFSD("EXIT (FAILED): err %d\n", err); |
343 | return ERR_PTR(err); | 342 | return ERR_PTR(err); |
344 | failed: | 343 | failed: |
345 | mutex_unlock(&sbi->s_lock); | 344 | unlock_ufs(sb); |
346 | make_bad_inode(inode); | 345 | make_bad_inode(inode); |
347 | iput (inode); | 346 | iput (inode); |
348 | UFSD("EXIT (FAILED): err %d\n", err); | 347 | UFSD("EXIT (FAILED): err %d\n", err); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index c1183f9f69dc..b879f1ba3439 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -697,7 +697,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) | |||
697 | unsigned flags; | 697 | unsigned flags; |
698 | 698 | ||
699 | lock_ufs(sb); | 699 | lock_ufs(sb); |
700 | mutex_lock(&UFS_SB(sb)->s_lock); | ||
701 | 700 | ||
702 | UFSD("ENTER\n"); | 701 | UFSD("ENTER\n"); |
703 | 702 | ||
@@ -715,7 +714,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) | |||
715 | ufs_put_cstotal(sb); | 714 | ufs_put_cstotal(sb); |
716 | 715 | ||
717 | UFSD("EXIT\n"); | 716 | UFSD("EXIT\n"); |
718 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
719 | unlock_ufs(sb); | 717 | unlock_ufs(sb); |
720 | 718 | ||
721 | return 0; | 719 | return 0; |
@@ -760,6 +758,7 @@ static void ufs_put_super(struct super_block *sb) | |||
760 | 758 | ||
761 | ubh_brelse_uspi (sbi->s_uspi); | 759 | ubh_brelse_uspi (sbi->s_uspi); |
762 | kfree (sbi->s_uspi); | 760 | kfree (sbi->s_uspi); |
761 | mutex_destroy(&sbi->mutex); | ||
763 | kfree (sbi); | 762 | kfree (sbi); |
764 | sb->s_fs_info = NULL; | 763 | sb->s_fs_info = NULL; |
765 | UFSD("EXIT\n"); | 764 | UFSD("EXIT\n"); |
@@ -786,6 +785,14 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
786 | flags = 0; | 785 | flags = 0; |
787 | 786 | ||
788 | UFSD("ENTER\n"); | 787 | UFSD("ENTER\n"); |
788 | |||
789 | #ifndef CONFIG_UFS_FS_WRITE | ||
790 | if (!(sb->s_flags & MS_RDONLY)) { | ||
791 | printk("ufs was compiled with read-only support, " | ||
792 | "can't be mounted as read-write\n"); | ||
793 | return -EROFS; | ||
794 | } | ||
795 | #endif | ||
789 | 796 | ||
790 | sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); | 797 | sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); |
791 | if (!sbi) | 798 | if (!sbi) |
@@ -795,15 +802,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
795 | 802 | ||
796 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); | 803 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); |
797 | 804 | ||
798 | #ifndef CONFIG_UFS_FS_WRITE | ||
799 | if (!(sb->s_flags & MS_RDONLY)) { | ||
800 | printk("ufs was compiled with read-only support, " | ||
801 | "can't be mounted as read-write\n"); | ||
802 | goto failed; | ||
803 | } | ||
804 | #endif | ||
805 | mutex_init(&sbi->mutex); | 805 | mutex_init(&sbi->mutex); |
806 | mutex_init(&sbi->s_lock); | ||
807 | spin_lock_init(&sbi->work_lock); | 806 | spin_lock_init(&sbi->work_lock); |
808 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); | 807 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); |
809 | /* | 808 | /* |
@@ -1257,6 +1256,7 @@ magic_found: | |||
1257 | return 0; | 1256 | return 0; |
1258 | 1257 | ||
1259 | failed: | 1258 | failed: |
1259 | mutex_destroy(&sbi->mutex); | ||
1260 | if (ubh) | 1260 | if (ubh) |
1261 | ubh_brelse_uspi (uspi); | 1261 | ubh_brelse_uspi (uspi); |
1262 | kfree (uspi); | 1262 | kfree (uspi); |
@@ -1280,7 +1280,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1280 | 1280 | ||
1281 | sync_filesystem(sb); | 1281 | sync_filesystem(sb); |
1282 | lock_ufs(sb); | 1282 | lock_ufs(sb); |
1283 | mutex_lock(&UFS_SB(sb)->s_lock); | ||
1284 | uspi = UFS_SB(sb)->s_uspi; | 1283 | uspi = UFS_SB(sb)->s_uspi; |
1285 | flags = UFS_SB(sb)->s_flags; | 1284 | flags = UFS_SB(sb)->s_flags; |
1286 | usb1 = ubh_get_usb_first(uspi); | 1285 | usb1 = ubh_get_usb_first(uspi); |
@@ -1294,7 +1293,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1294 | new_mount_opt = 0; | 1293 | new_mount_opt = 0; |
1295 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); | 1294 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); |
1296 | if (!ufs_parse_options (data, &new_mount_opt)) { | 1295 | if (!ufs_parse_options (data, &new_mount_opt)) { |
1297 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1298 | unlock_ufs(sb); | 1296 | unlock_ufs(sb); |
1299 | return -EINVAL; | 1297 | return -EINVAL; |
1300 | } | 1298 | } |
@@ -1302,14 +1300,12 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1302 | new_mount_opt |= ufstype; | 1300 | new_mount_opt |= ufstype; |
1303 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { | 1301 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { |
1304 | printk("ufstype can't be changed during remount\n"); | 1302 | printk("ufstype can't be changed during remount\n"); |
1305 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1306 | unlock_ufs(sb); | 1303 | unlock_ufs(sb); |
1307 | return -EINVAL; | 1304 | return -EINVAL; |
1308 | } | 1305 | } |
1309 | 1306 | ||
1310 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1307 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1311 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1308 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1312 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1313 | unlock_ufs(sb); | 1309 | unlock_ufs(sb); |
1314 | return 0; | 1310 | return 0; |
1315 | } | 1311 | } |
@@ -1334,7 +1330,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1334 | #ifndef CONFIG_UFS_FS_WRITE | 1330 | #ifndef CONFIG_UFS_FS_WRITE |
1335 | printk("ufs was compiled with read-only support, " | 1331 | printk("ufs was compiled with read-only support, " |
1336 | "can't be mounted as read-write\n"); | 1332 | "can't be mounted as read-write\n"); |
1337 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1338 | unlock_ufs(sb); | 1333 | unlock_ufs(sb); |
1339 | return -EINVAL; | 1334 | return -EINVAL; |
1340 | #else | 1335 | #else |
@@ -1344,13 +1339,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1344 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && | 1339 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && |
1345 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { | 1340 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { |
1346 | printk("this ufstype is read-only supported\n"); | 1341 | printk("this ufstype is read-only supported\n"); |
1347 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1348 | unlock_ufs(sb); | 1342 | unlock_ufs(sb); |
1349 | return -EINVAL; | 1343 | return -EINVAL; |
1350 | } | 1344 | } |
1351 | if (!ufs_read_cylinder_structures(sb)) { | 1345 | if (!ufs_read_cylinder_structures(sb)) { |
1352 | printk("failed during remounting\n"); | 1346 | printk("failed during remounting\n"); |
1353 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1354 | unlock_ufs(sb); | 1347 | unlock_ufs(sb); |
1355 | return -EPERM; | 1348 | return -EPERM; |
1356 | } | 1349 | } |
@@ -1358,7 +1351,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1358 | #endif | 1351 | #endif |
1359 | } | 1352 | } |
1360 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1353 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1361 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1362 | unlock_ufs(sb); | 1354 | unlock_ufs(sb); |
1363 | return 0; | 1355 | return 0; |
1364 | } | 1356 | } |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index ff2c15ab81aa..343e6fc571e5 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
@@ -24,7 +24,6 @@ struct ufs_sb_info { | |||
24 | int work_queued; /* non-zero if the delayed work is queued */ | 24 | int work_queued; /* non-zero if the delayed work is queued */ |
25 | struct delayed_work sync_work; /* FS sync delayed work */ | 25 | struct delayed_work sync_work; /* FS sync delayed work */ |
26 | spinlock_t work_lock; /* protects sync_work and work_queued */ | 26 | spinlock_t work_lock; /* protects sync_work and work_queued */ |
27 | struct mutex s_lock; | ||
28 | }; | 27 | }; |
29 | 28 | ||
30 | struct ufs_inode_info { | 29 | struct ufs_inode_info { |