From: "Aurélien Aptel" <aaptel-IBi9RG/b67k@public.gmane.org>
To: Stanislav Brabec <sbrabec-AlSwsSmVLrQ@public.gmane.org>
Cc: util-linux <util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: nfs/cifs mountinfo differences (was: Re: [PATCH] libmount: Skip root comparison for cifs in mnt_table_is_fs_mounted())
Date: Fri, 5 Aug 2016 19:22:34 +0200 [thread overview]
Message-ID: <20160805192234.2c9d5b7d@aaptelpc> (raw)
In-Reply-To: <5eb96b3e-d463-bf11-49de-f614247d6b29-AlSwsSmVLrQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 4008 bytes --]
I have looked a bit more into it.
Linux provides filesystems a way to show their own thing in the 4th
column (documented as "root of the mount within the filesystem"). The
presence of this mechanism makes me think this info wasn't made only to
be altered by bind-mounts.
The mechanism in question is the superblock operation 'show_path'. If a
filesystem doesn't provide one, linux default is to walk the dentry
connected to the mount points until it reaches the fs root and print
that. This is what happens in (recent) CIFS.
+------------------+
| cifs super_block |
+------------------+ +------------------+
|rootfs super_block| | s_root |
+------------------+ +------------------+
| s_root | |
+------------------+ v
| [ dentry "/" ]
| |
| v
v [ dentry "sub" ]
[dentry "/"] |
v v
[dentry "mnt"] -----magic------> [ dentry "dir" ]
|
vvv
[ content of "/sub/dir/" ]
CIFS doesn't override the default show_path so mountinfo walks from
"dir" to "/" and prints "/sub/dir".
NFS on the other hand overides the show_path operation to:
int nfs_show_path(struct seq_file *m, struct dentry *dentry)
{
seq_puts(m, "/");
return 0;
}
ie. *always* prints "/".
Now correct me if I'm wrong (I really am not sure) but I think 'mount
-a' assumes only bind-mounts should print a subdir path instead of "/".
So either
(A) we make that assumption explicit and consider it the Truth:
- we update the kernel documentation of that column in
Documentation/filesystems/proc.txt to read something like "path
binded within the filesystem"
- like NFS, we override show_path to always return "/".
- leave mount utility unchanged.
or (B) we consider the current kernel doc as the Truth:
- we make NFS do like CIFS
- leave CIFS unchanged [1]
- figure out what to do with mount utility (back to initial problem I
guess)
Personal opinion: the way the current doc is written and again, the fact
that linux lets you override the path on a per-filesystem basis makes me
think solution B is the way to go.
Also, I don't understand why
On Wed, 3 Aug 2016 19:23:06 +0200 Stanislav Brabec <sbrabec-AlSwsSmVLrQ@public.gmane.org>
wrote:
> > Skipping root comparison in mnt_table_is_fs_mounted() makes things
> > better, however it still does not cover all possible setups.
and
> > diff --git a/libmount/src/tab.c b/libmount/src/tab.c
> > index 155c65e..aa9185a 100644
> > --- a/libmount/src/tab.c
> > +++ b/libmount/src/tab.c
> > @@ -1562,7 +1562,10 @@ int mnt_table_is_fs_mounted(struct
> > libmnt_table *tb, struct libmnt_fs *fstab_fs) #endif
> > }
> >
> > - if (root) {
> > + /* For cifs, root contains a relative path to the
> > exported volume,
> > + * i. e. something we cannot compare.
> > + */
> > + if (root && strcmp(mnt_fs_get_fstype(fs), "cifs"))
> > { const char *r = mnt_fs_get_root(fs);
> > if (!r || strcmp(r, root) != 0)
> > continue;
> >
We can't we compare in this case? Isn't it just a matter of
concatenating the source with the subdir?
1: I believe we should still override show_path in CIFS
to take recent flag CIFS_USE_PREFIX_PATH into account because the
default show_path assumes a different dentry structure
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG
Nürnberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-08-05 17:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <91d465d3-4f5b-6270-a6c5-38bd94695731@suse.cz>
[not found] ` <91d465d3-4f5b-6270-a6c5-38bd94695731-AlSwsSmVLrQ@public.gmane.org>
2016-08-03 17:23 ` nfs/cifs mountinfo differences (was: Re: [PATCH] libmount: Skip root comparison for cifs in mnt_table_is_fs_mounted()) Stanislav Brabec
[not found] ` <5eb96b3e-d463-bf11-49de-f614247d6b29-AlSwsSmVLrQ@public.gmane.org>
2016-08-03 20:32 ` Steve French
2016-08-05 17:22 ` Aurélien Aptel [this message]
2016-08-16 17:44 ` nfs/cifs mountinfo differences Stanislav Brabec
[not found] ` <7c2181d1-c7b5-df04-0640-ec23f5d78eab-AlSwsSmVLrQ@public.gmane.org>
2016-08-23 17:23 ` Stanislav Brabec
[not found] ` <c4f10081-4525-4ac0-0e6b-b364c7268200-AlSwsSmVLrQ@public.gmane.org>
2016-08-23 17:25 ` [PATCH] libmount: Special handling of root comparison for cifs in mnt_table_is_fs_mounted() Stanislav Brabec
[not found] ` <eec8f575-eab2-34bb-882a-11fb8c33d9c0-AlSwsSmVLrQ@public.gmane.org>
2016-09-02 18:58 ` Aurélien Aptel
[not found] ` <mpsbn06ruwv.fsf-IBi9RG/b67k@public.gmane.org>
2016-09-29 9:55 ` 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=20160805192234.2c9d5b7d@aaptelpc \
--to=aaptel-ibi9rg/b67k@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sbrabec-AlSwsSmVLrQ@public.gmane.org \
--cc=util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).