Linux NFS development
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: nfs@lists.sourceforge.net, Steve Dickson <SteveD@redhat.com>
Subject: Re: [NFS] nfs-utils crossmnt/fsid bug
Date: Fri, 23 Nov 2007 13:50:29 +1100	[thread overview]
Message-ID: <18246.16373.177320.570040@notabene.brown> (raw)
In-Reply-To: message from J. Bruce Fields on Wednesday September 5

On Wednesday September 5, bfields@fieldses.org wrote:
> With an exports entry like
> 
> 	/exports *.citi.umich.edu(rw,crossmnt,fsid=0)
> 
> and some other stuff mounted under /exports, I get an odd situation
> where listing /exports/submnt/ shows me the contents of /exports/.
> 
> I looks to me like what's happening is that the new code to
> automatically export filesystems under crossmnt exports is exporting
> those directories with the fsid option turned on, with the result that
> the root of each of those subdirectories ends up with the same
> filehandle as the root of /exports, and the hilarity ensues.  But I
> haven't tried a patch yet.
> 
> Does that make sense?  I assume we should just clear the fsid flag on
> submounts, as it's never going to make sense, and leave the logic
> otherwise intact.
> 
> --b.

Thanks for noticing and reporting this.

Does this (untested, but it compiles) patch seem right?

NeilBrown

--------
When exported a filesystems with option inherited (by the crossmnt
option) from a higherlevel filesystem, ignore filesystem specific
options like FSID and explicit UUID.

Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index fd317cd..ff56b9f 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -565,20 +565,29 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
 	qword_print(f, path);
 	qword_printint(f, time(0)+30*60);
 	if (exp) {
-		qword_printint(f, exp->e_flags);
+		int different_fs = 0;
+		struct stat stb1, stb2;
+		if (stat(path, &stb1) == 0 &&
+		    stat(exp->e_path, &stb2) == 0 &&
+		    stb1.st_dev != stb2.st_dev)
+			different_fs = 1;
+		if (different_fs)
+			qword_printint(f, exp->e_flags & ~NFSEXP_FSID);
+		else
+			qword_printint(f, exp->e_flags);
 		qword_printint(f, exp->e_anonuid);
 		qword_printint(f, exp->e_anongid);
 		qword_printint(f, exp->e_fsid);
 		write_fsloc(f, exp, path);
 		write_secinfo(f, exp);
 #if USE_BLKID
- 		if (exp->e_uuid == NULL) {
+ 		if (exp->e_uuid == NULL || different_fs) {
  			char u[16];
  			if (get_uuid(path, NULL, 16, u)) {
  				qword_print(f, "uuid");
  				qword_printhex(f, u, 16);
  			}
- 		} else if (exp->e_uuid) {
+ 		} else {
  			qword_print(f, "uuid");
  			qword_printhex(f, exp->e_uuid, 16);
  		}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that nfs@lists.sourceforge.net is being discontinued.
Please subscribe to linux-nfs@vger.kernel.org instead.
    http://vger.kernel.org/vger-lists.html#linux-nfs


  reply	other threads:[~2007-11-23  2:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 20:46 nfs-utils crossmnt/fsid bug J. Bruce Fields
2007-11-23  2:50 ` Neil Brown [this message]
     [not found]   ` <18246.16373.177320.570040-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2007-11-26 22:39     ` [NFS] " J. Bruce Fields
2007-11-29  3:59       ` Neil Brown
2007-12-03 22:51     ` Frank Filz
2007-12-04  1:09       ` Neil Brown
     [not found]         ` <18260.43206.943331.889058-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2007-12-04 17:42           ` Frank Filz
2007-12-07 19:05             ` Frank Filz
2007-12-11 21:20       ` Frank Filz

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=18246.16373.177320.570040@notabene.brown \
    --to=neilb@suse.de \
    --cc=SteveD@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=nfs@lists.sourceforge.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