Re: multiple device exports for knfsd

Olaf Kirch (
Thu, 20 Nov 1997 22:06:55 +0100

Hi Bill,

> People have requested the ability to separately export multiple
> directories on a single device in knfsd, and I can't see any apparent
> reason not to allow this. But the export code was clearly designed to
> allow only a single export per device; it checks for a unique match of
> the inode number rather than searching until it finds the desired inode.

The problem with multiple exports per device is that you have to be
extra careful with lookups, and link/rename operations between
different exports.

The first is that you have to check whether the result of a lookup(..)
operation is in a different volume. The simplest case is that
you don't want to move into an unexported part of the FS at all (this
seems to be possible with the current implementation; I had quite
elaborate checks for this in 2.1.36 but they seem to have disappeared).
For the case you're thinking of, you'd have to apply this check also
when moving _down_ the path because, e.g. /usr may have been assigned
different export options than /usr/local.

The second problem is e.g. with link operations. Suppose you've got
a single disk, and exported /usr readonly with root squashing etc,
while /home is readwrite and doesn't have root squashing. Then
root on some client might create a hard link from /usr/bin/vi to
/home/joedoe/vi and overwrite the file.

I didn't believe the issue was that serious for so many people; most
other unices also support just one export per disk. However, it should
be possible to do this if demand is really huge; but given the
complications I would leave things the way for now until the rest
works. (Except for restoring the pre-dentry checks for .. lookups. This
is really a big security issue).

A quite different things also having to do with exports is that people
have been complaining early on that when they export /mnt/cdrom they
can't unmount the cdrom anymore... I'm not sure how that could be


Olaf Kirch         |  --- o --- Nous sommes du soleil we love when we play  |    / | \   sol.dhoop.naytheet.ah    +-------------------- Why Not?! -----------------------