From: NeilBrown <neilb@suse.com>
To: util-linux@vger.kernel.org,
Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Cc: Franck Bui <fbui@suse.com>
Subject: [nfs-utils PATCH] umount.nfs: assume path name is canonical.
Date: Mon, 05 Jun 2017 12:38:39 +1000 [thread overview]
Message-ID: <8737bfduq8.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <8760gbduzp.fsf@notabene.neil.brown.name>
[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]
/usr/bin/umount will always pass a canonical name
to umount.nfs, so it is safe to disable canonicalization.
When umounting an NFS filesystem, it is generally safest to
not "stat" the mountpoint at all as that can block
indefinitely. umount() will not block, but lstat() etc can.
By disabling canonicalization in libmount, we discourage it
from ever calling 'stat' family operations, and thus reduce
the chance of a hang.
Note that to be fully effective, this requires changes to
util-linux which have not yet been accepted.
When both that change and this are in effect, automounters
can use "umount -c $PATH" to safely unmount a filesystem
without blocking.
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/mount/mount_libmount.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/mount/mount_libmount.c b/utils/mount/mount_libmount.c
index 1f01f7f7a4e7..2d4065759a6c 100644
--- a/utils/mount/mount_libmount.c
+++ b/utils/mount/mount_libmount.c
@@ -188,6 +188,7 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
};
mnt_context_init_helper(cxt, MNT_ACT_UMOUNT, 0);
+ mnt_context_disable_canonicalize(cxt, 1);
while ((c = getopt_long (argc, argv, "fvnrlh", longopts, NULL)) != -1) {
--
2.12.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-06-05 2:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 2:32 [util-linux PATCH] umount: never 'stat' the path when "-c" is given NeilBrown
2017-06-05 2:38 ` NeilBrown [this message]
2017-06-13 12:40 ` [nfs-utils PATCH] umount.nfs: assume path name is canonical Steve Dickson
2017-06-06 9:43 ` [util-linux PATCH] umount: never 'stat' the path when "-c" is given Karel Zak
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=8737bfduq8.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=fbui@suse.com \
--cc=linux-nfs@vger.kernel.org \
--cc=util-linux@vger.kernel.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).