[PATCH] Fix multiple blockdev-based filesystem mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The attached patch fixes multiple mounts of the same blockdev-based filesystem
(such as EXT3). The problem is that the path through the function that deals
with a second mount of an already extant superblock is going out through the
error path and not the success path that sets up the vfsmount.

The error can be checked by doing something like:

	mount /dev/hda6 /a
	mount /dev/hda6 /b

Where /dev/hda6 has something like an EXT3 filesystem on it. The second mount
should succeed, but doesn't without this patch.

This patch is dependent on the getsb patch submitted earlier.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 /tmp/get_sb_bdev.diff 
 fs/super.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 7353011..8fe179e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -697,15 +697,17 @@ int get_sb_bdev(struct file_system_type 
 	s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
 	up(&bdev->bd_mount_sem);
 	if (IS_ERR(s))
-		goto out_s_error;
+		goto error_s;
 
 	if (s->s_root) {
 		if ((flags ^ s->s_flags) & MS_RDONLY) {
 			up_write(&s->s_umount);
 			deactivate_super(s);
 			error = -EBUSY;
+			goto error_bdev;
 		}
-		goto out;
+
+		close_bdev_excl(bdev);
 	} else {
 		char b[BDEVNAME_SIZE];
 
@@ -725,9 +727,9 @@ int get_sb_bdev(struct file_system_type 
 
 	return simple_set_mnt(mnt, s);
 
-out_s_error:
+error_s:
 	error = PTR_ERR(s);
-out:
+error_bdev:
 	close_bdev_excl(bdev);
 error:
 	return error;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux