[Linux-cachefs] [PATCH] Fix multiple blockdev-based filesystem mounts

David Howells dhowells at redhat.com
Tue Mar 7 11:08:41 UTC 2006


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 <dhowells at redhat.com>
---
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;




More information about the Linux-cachefs mailing list