linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Waychison <michael.waychison@sun.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: raven@themaw.net
Subject: [PATCH 8/28] VFS: Remove MNT_EXPIRE support
Date: Mon, 25 Oct 2004 10:42:32 -0400	[thread overview]
Message-ID: <10987153522992@sun.com> (raw)
In-Reply-To: <10987153211852@sun.com>

Drop support for MNT_EXPIRE (flag to umount(2)).  Nobody was using it and it
didn't fit into the new expiry framework.

Note: maybe make this bit a DO NOT USE bit?

Signed-off-by: Mike Waychison <michael.waychison@sun.com>
---

 fs/namespace.c     |   45 +++++++++------------------------------------
 include/linux/fs.h |    1 -
 2 files changed, 9 insertions(+), 37 deletions(-)

Index: linux-2.6.9-quilt/include/linux/fs.h
===================================================================
--- linux-2.6.9-quilt.orig/include/linux/fs.h	2004-08-14 01:36:32.000000000 -0400
+++ linux-2.6.9-quilt/include/linux/fs.h	2004-10-22 17:17:37.120820920 -0400
@@ -719,7 +719,6 @@ extern int send_sigurg(struct fown_struc
 
 #define MNT_FORCE	0x00000001	/* Attempt to forcibily umount */
 #define MNT_DETACH	0x00000002	/* Just detach from the tree */
-#define MNT_EXPIRE	0x00000004	/* Mark for expiry */
 
 extern struct list_head super_blocks;
 extern spinlock_t sb_lock;
Index: linux-2.6.9-quilt/fs/namespace.c
===================================================================
--- linux-2.6.9-quilt.orig/fs/namespace.c	2004-10-22 17:17:35.929002104 -0400
+++ linux-2.6.9-quilt/fs/namespace.c	2004-10-22 17:17:37.121820768 -0400
@@ -157,11 +157,12 @@ static struct vfsmount *next_mnt(struct 
 	return list_entry(next, struct vfsmount, mnt_child);
 }
 
-static int __can_expire(struct vfsmount *root, int offset)
+/* this expects the caller to hold vfsmount_lock */
+static int can_expire(struct vfsmount *root, int offset)
 {
 	struct vfsmount *mnt;
 	int count;
-	
+
 	/* handle the case of a root or orphaned mountpoint */
 	if (root->mnt_parent == root || root->mnt_parent == NULL)
 		return 0;
@@ -171,18 +172,9 @@ static int __can_expire(struct vfsmount 
 			return 0;
 		count += atomic_read(&mnt->mnt_count) - 2;
 	}
-	
-	WARN_ON(count < 0);
-	return count == 0;	
-}
 
-static int can_expire(struct vfsmount *root)
-{
-	int ret;
-	spin_lock(&vfsmount_lock);
-	ret = __can_expire(root, 1);
-	spin_unlock(&vfsmount_lock);
-	return ret;
+	WARN_ON(count < 0);
+	return count == 0;
 }
 
 static struct vfsmount *
@@ -453,24 +445,6 @@ static int do_umount(struct vfsmount *mn
 		return retval;
 
 	/*
-	 * Allow userspace to request a mountpoint be expired rather than
-	 * unmounting unconditionally. Unmount only happens if:
-	 *  (1) the mark is already set (the mark is cleared by mntput())
-	 *  (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
-	 */
-	if (flags & MNT_EXPIRE) {
-		if (mnt == current->fs->rootmnt ||
-		    flags & (MNT_FORCE | MNT_DETACH))
-			return -EINVAL;
-
-		if (!can_expire(mnt))
-			return -EBUSY;
-
-		if (--mnt->mnt_expiry_countdown != 0)
-			return -EAGAIN;
-	}
-
-	/*
 	 * If we may have to abort operations to get out of this
 	 * mount, and they will themselves hold resources we must
 	 * allow the fs to do things. In the Unix tradition of
@@ -524,8 +498,7 @@ static int do_umount(struct vfsmount *mn
 		spin_lock(&vfsmount_lock);
 	}
 	retval = -EBUSY;
-	if (atomic_read(&mnt->mnt_count) == 2 || flags & MNT_DETACH
-		|| (flags & MNT_EXPIRE && can_expire(mnt))) {
+	if (atomic_read(&mnt->mnt_count) == 2 || flags & MNT_DETACH) {
 		if (!list_empty(&mnt->mnt_list)) {
 			clear_expire(mnt);
 			umount_tree(mnt);
@@ -1019,7 +992,7 @@ static void do_expiry_run(void *nothing)
 		}
 		if (mnt->mnt_expiry_countdown >= 1)
 			mnt->mnt_expiry_countdown--;
-		if (__can_expire(mnt, 0) && mnt->mnt_expiry_countdown == 0) {
+		if (can_expire(mnt, 0) && mnt->mnt_expiry_countdown == 0) {
 			mntget(mnt);
 			list_move(&mnt->mnt_expire, &graveyard);
 		}
@@ -1048,7 +1021,7 @@ static void do_expiry_run(void *nothing)
 		down_write(&namespace->sem);
 		spin_lock(&vfsmount_lock);
 
-		if (!__can_expire(mnt, 1) || mnt->mnt_active) {
+		if (!can_expire(mnt, 1) || mnt->mnt_active) {
 			list_add_tail(&mnt->mnt_expire, &expiry_list);
 		} else {
 			parent = find_expiring_parent(mnt);
@@ -1057,7 +1030,7 @@ static void do_expiry_run(void *nothing)
 			umount_tree(mnt);
 
 			/* the parent may be expirable now */
-			if (parent && __can_expire(parent, 1) &&
+			if (parent && can_expire(parent, 1) &&
 			    parent->mnt_expiry_countdown == 0 &&
 			    !parent->mnt_active) {
 				list_move_tail(&parent->mnt_expire, &graveyard);


  reply	other threads:[~2004-10-25 14:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-25 14:38 [PATCH 0/28] Autofs NG Patchset 0.2 Mike Waychison
2004-10-25 14:39 ` [PATCH 1/28] VFS: Unexport umount_tree Mike Waychison
2004-10-25 14:39   ` [PATCH 2/28] VFS: mnt_fslink -> mnt_expire Mike Waychison
2004-10-25 14:40     ` [PATCH 3/28] VFS: Move expiry into vfs Mike Waychison
2004-10-25 14:40       ` [PATCH 4/28] VFS: Stat shouldn't stop expire Mike Waychison
2004-10-25 14:41         ` [PATCH 5/28] VFS: Make expiry timeout configurable Mike Waychison
2004-10-25 14:41           ` [PATCH 6/28] VFS: Make expiry recursive Mike Waychison
2004-10-25 14:42             ` [PATCH 7/28] AFS: Update AFS to use new expiry interface Mike Waychison
2004-10-25 14:42               ` Mike Waychison [this message]
2004-10-25 14:43                 ` [PATCH 9/28] VFS: Give sane expiry semantics Mike Waychison
2004-10-25 14:43                   ` [PATCH 10/28] VFS: Move next_mnt() Mike Waychison
2004-10-25 14:44                     ` [PATCH 11/28] VFS: Allow for detachable subtrees Mike Waychison
2004-10-25 14:44                       ` [PATCH 12/28] VFS: Remove (now bogus) check_mnt Mike Waychison
2004-10-25 14:45                         ` [PATCH 13/28] VFS: Introduce soft reference counts Mike Waychison
2004-10-25 15:25                           ` Christoph Hellwig
2004-10-25 15:35                             ` [PATCH 14/28] VFS: Introduce Mountpoint file descriptors (resend) Mike Waychison
2004-10-25 17:20                           ` [PATCH 13/28] VFS: Introduce soft reference counts Mika Penttilä
2004-10-25 17:25                             ` Mike Waychison
2004-10-25 17:52                               ` Mika Penttilä
2004-10-25 17:56                                 ` [PATCH 11/28] VFS: Allow for detachable subtrees (resend) Mike Waychison
2004-10-25 15:09                         ` [PATCH 12/28] VFS: Remove (now bogus) check_mnt Christoph Hellwig
2004-10-25 15:15                           ` Mike Waychison
2004-10-25 15:04                 ` [PATCH 8/28] VFS: Remove MNT_EXPIRE support Christoph Hellwig
2004-10-25 15:12                   ` Mike Waychison
2004-10-25 15:16                     ` Christoph Hellwig
2004-10-25 15:30                       ` Mike Waychison
2004-10-25 17:16                   ` Mike Waychison
2004-10-25 17:29                     ` Mike Waychison
2004-10-25 15:04             ` [PATCH 6/28] VFS: Make expiry recursive Christoph Hellwig
2004-10-26 10:27         ` [PATCH 4/28] VFS: Stat shouldn't stop expire Christoph Hellwig
2004-10-27 18:36           ` Mike Waychison
2004-10-25 14:59       ` [PATCH 3/28] VFS: Move expiry into vfs Christoph Hellwig

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=10987153522992@sun.com \
    --to=michael.waychison@sun.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    /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).