linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	netdev@vger.kernel.org, dhowells@redhat.com
Subject: [PATCH 10/16] AFS: Handle multiple mounts of an AFS superblock correctly [try #3]
Date: Wed, 25 Apr 2007 11:51:29 +0100	[thread overview]
Message-ID: <20070425105129.10872.1324.stgit@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20070425105036.10872.48596.stgit@warthog.cambridge.redhat.com>

Handle multiple mounts of an AFS superblock correctly, checking to see whether
the superblock is already initialised after calling sget() rather than just
unconditionally stamping all over it.

Also delete the "silent" parameter to afs_fill_super() as it's not used and
can, in any case, be obtained from sb->s_flags.

Signed-Off-By: David Howells <dhowells@redhat.com>
---

 fs/afs/super.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index efc4fe6..77e6875 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -212,7 +212,7 @@ static int afs_test_super(struct super_block *sb, void *data)
 /*
  * fill in the superblock
  */
-static int afs_fill_super(struct super_block *sb, void *data, int silent)
+static int afs_fill_super(struct super_block *sb, void *data)
 {
 	struct afs_mount_params *params = data;
 	struct afs_super_info *as = NULL;
@@ -319,17 +319,23 @@ static int afs_get_sb(struct file_system_type *fs_type,
 		goto error;
 	}
 
-	sb->s_flags = flags;
-
-	ret = afs_fill_super(sb, &params, flags & MS_SILENT ? 1 : 0);
-	if (ret < 0) {
-		up_write(&sb->s_umount);
-		deactivate_super(sb);
-		goto error;
+	if (!sb->s_root) {
+		/* initial superblock/root creation */
+		_debug("create");
+		sb->s_flags = flags;
+		ret = afs_fill_super(sb, &params);
+		if (ret < 0) {
+			up_write(&sb->s_umount);
+			deactivate_super(sb);
+			goto error;
+		}
+		sb->s_flags |= MS_ACTIVE;
+	} else {
+		_debug("reuse");
+		ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
 	}
-	sb->s_flags |= MS_ACTIVE;
-	simple_set_mnt(mnt, sb);
 
+	simple_set_mnt(mnt, sb);
 	afs_put_volume(params.volume);
 	afs_put_cell(params.default_cell);
 	_leave(" = 0 [%p]", sb);


  parent reply	other threads:[~2007-04-25 10:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070425041514.bb770377.akpm@linux-foundation.org>
2007-04-25 10:50 ` [PATCH 00/16] AF_RXRPC socket family and AFS rewrite [try #3] David Howells
2007-04-25 10:50   ` [PATCH 01/16] AF_RXRPC: Move generic skbuff stuff from XFRM code to generic code " David Howells
2007-04-25 10:50   ` [PATCH 02/16] cancel_delayed_work: use del_timer() instead of del_timer_sync() " David Howells
2007-04-25 10:50   ` [PATCH 03/16] AF_RXRPC: Key facility changes for AF_RXRPC " David Howells
2007-04-25 10:50   ` [PATCH 04/16] AF_RXRPC: Make it possible to merely try to cancel timers from a module " David Howells
2007-04-25 10:51   ` [PATCH 07/16] AF_RXRPC: Add an interface to the AF_RXRPC module for the AFS filesystem to use " David Howells
2007-04-25 10:51   ` David Howells [this message]
2007-04-25 10:51   ` [PATCH 11/16] AFS: Add security support " David Howells
2007-04-25 10:51   ` [PATCH 12/16] AFS: Update the AFS fs documentation " David Howells
2007-04-25 10:51   ` [PATCH 13/16] commit ad495d7b6cfcd1bc2eaf06c42699be0bb5d84234 " David Howells
2007-04-25 10:51   ` [PATCH 14/16] AFS: Add support for the CB.GetCapabilities operation " David Howells
2007-04-25 10:51   ` [PATCH 15/16] AFS: Implement the CB.InitCallBackState3 " David Howells
2007-04-25 10:52   ` [PATCH 16/16] AFS: Add "directory write" support " David Howells
2007-04-25 13:38   ` [PATCH 00/16] AF_RXRPC socket family and AFS rewrite " David Howells
2007-04-25 19:43     ` David Miller
2007-04-25 19:56     ` David Howells
2007-04-25 20:02       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070425105129.10872.1324.stgit@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).