public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: umount of unreachable NFS without -f [maybe PATCH]
Date: Wed, 03 Sep 2014 15:30:14 +0200	[thread overview]
Message-ID: <1409751014.14709.24.camel@oct.suse.cz> (raw)
In-Reply-To: <20140903074517.GD21325@x2.net.home>

Karel Zak wrote:
> On Tue, Sep 02, 2014 at 09:09:38PM +0200, Stanislav Brabec wrote:
> > I just analyzed causes of hang while calling umount without -f on an
> > unreachable NFS.
> > 
> > The first hang happens on in lookup_umount_fs():
> > 
> > stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)
> > 
> > I don't exactly know, what its removal causes, but I tried it.
> > 
> > I entered into next hang in mnt_resolve_path() inside has_utab_entry().
> > We cannot prevent this hang in all cases, but preventing it in a
> > standard situation is pretty straightforward: Try to match provided
> > target name before trying to canonicalize.
> > 
> > Now my umount without -f works well at least in the case, when the mount
> > point is recorded in the utab.
> > 
> > If it is not recorded in utab, it still hangs later in
> > lookup_umount_fs() on:
> > 
> > if (statfs(tgt, &vfs) == 0)
> > 
> > Well, we can prevent even this hang, but it would be at cost of parsing
> > mtab. I read your git comments and I see, that the whole purpose of the
> > code is preventing of parsing of the generated mtab/mountinfo.
> > 
> > Would be parsing of fstab a safe way without paying this cost?
> 
> How often do you have NFS mounts without entry within utab? I think it's
> pretty unusual (I guess you have mount.nfs linked with libmount).

I did it somehow. Guessing that it could have something with my
experiments, killing hanging umount with signal 11 etc.

> The change in has_utab_entry() is definitely good idea, but I'm not
> sure about the rest. Maybe it would be enough to call has_utab_entry()
> before
> 
>     stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)
> 
> 
> then it will be good enough for almost all NFS mounts (with utab
> entries).

Yes, I just verified that it helps as well.

But I found just another stat() call further in
mnt_context_find_umount_fs():
if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {
before cache lookups.

And next there is:
cn_tgt = mnt_resolve_path(tgt, cache);
which will probably hang as well.

I can imagine that we will not uses stat() here, but I cannot imagine,
how to set filter correctly without canonicalization.

I am just curious why one of my umount attempts of unresponsive NFS
succeeded yesterday...

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76


  reply	other threads:[~2014-09-03 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 19:09 umount of unreachable NFS without -f [maybe PATCH] Stanislav Brabec
2014-09-03  7:45 ` Karel Zak
2014-09-03 13:30   ` Stanislav Brabec [this message]
2014-09-03  7:49 ` 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=1409751014.14709.24.camel@oct.suse.cz \
    --to=sbrabec@suse.cz \
    --cc=kzak@redhat.com \
    --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