Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Nov 2009 17:43:06 +0100 (CET)
From:      Alexander Best <alexbestms@math.uni-muenster.de>
To:        <garyj@denx.de>, Alexander Best <alexbestms@math.uni-muenster.de>
Cc:        freebsd-hackers@FreeBSD.org, Alexander Best <alexbestms@math.uni-muenster.de>, Alex Dupre <ale@FreeBSD.org>
Subject:   Re: rmdir(2) and mkdir(2) both return EISDIR for argument "/"
Message-ID:  <permail-2009110616430680e26a0b000006fe-a_best01@message-id.uni-muenster.de>
In-Reply-To: <20091106170853.7d0b0b6f@ernst.jennejohn.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  This is a MIME encoded multipart message.

--+permail-2009110616430680e26a0b000006fe-a_best01+
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Gary Jennejohn schrieb am 2009-11-06:
> On Fri, 06 Nov 2009 16:32:22 +0100 (CET)
> Alexander Best <alexbestms@math.uni-muenster.de> wrote:

> > Alex Dupre schrieb am 2009-11-06:
> > > Alexander Best ha scritto:
> > > > i dug up this old pr
> > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/59739

> > > I think the EISDIR error is coming from kern/vfs_lookup.c,
> > > lookup()
> > > function with cn_nameptr = "":


> > >         /*
> > >          * Check for degenerate name (e.g. / or "")
> > >          * which is a way of talking about a directory,
> > >          * e.g. like "/." or ".".
> > >          */
> > >         if (cnp->cn_nameptr[0] == '\0') {
> > >                 ...
> > >                 if (cnp->cn_nameiop != LOOKUP) {
> > >                         error = EISDIR;
> > >                         goto bad;
> > >                 }
> > >                 ...

> > thanks a lot for finding the problem in the src. what do you think
> > of the
> > patch attached to this message? after applying it the example code
> > i posted in
> > my previous message returns the following output (instead of
> > EISDIR):

> > rmdir errno: 16 (which is EBUSY)
> > mkdir errno: 17 (which is EEXIST)

> > i don't know if these really are the correct return values, but
> > it's what the
> > originator of the PR requested.


> What if cn_nameiop is != LOOKUP but also neither DELETE nor CREATE,
> assuming that case is possible?  I'd leave the original if-clause at
> the end to catch that.

> ---
> Gary Jennejohn

how about this patch?

1. i've added "if (cnp->cn_nameiop != LOOKUP)" although i don't think it's
necessary since the first blocks should cover all the possible cases.
2. i've used rename() to test the case (cnp->cn_nameiop != RENAME). is this
correct or does rename() use a combo of DELETE and CREATE? problem is that the
rename(2) manual doesn't seem to cover the case that arg 1 is a mountpoint.
right now EBUSY gets returned if cnp->cn_nameiop != RENAME. however BUSY needs
to be added to all manuals which use cnp->cn_nameiop != RENAME (shouldn't be
too many). or are there any other suggestions what rename() should return if
arg 1 is a mountpoint?

cheers.
alex

--+permail-2009110616430680e26a0b000006fe-a_best01+
Content-Type: text/plain
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename="vfslookup.c.patch.txt"

LS0tIHZmc19sb29rdXAuYwkyMDA5LTExLTA2IDE2OjE0OjQxLjAwMDAwMDAwMCArMDEwMAorKysg
L3Vzci9zcmMvc3lzL2tlcm4vdmZzX2xvb2t1cC5jCTIwMDktMTEtMDYgMTc6NDE6NDAuMDAwMDAw
MDAwICswMTAwCkBAIC0zNSw3ICszNSw3IEBACiAgKi8KIAogI2luY2x1ZGUgPHN5cy9jZGVmcy5o
PgotX19GQlNESUQoIiRGcmVlQlNEJCIpOworX19GQlNESUQoIiRGcmVlQlNEOiBoZWFkL3N5cy9r
ZXJuL3Zmc19sb29rdXAuYyAxOTU5MzkgMjAwOS0wNy0yOSAwNzo0NDo0M1ogcndhdHNvbiAkIik7
CiAKICNpbmNsdWRlICJvcHRfa2R0cmFjZS5oIgogI2luY2x1ZGUgIm9wdF9rdHJhY2UuaCIKQEAg
LTU2Myw2ICs1NjMsMTUgQEAKIAkJCWVycm9yID0gRU5PVERJUjsKIAkJCWdvdG8gYmFkOwogCQl9
CisJCWlmIChjbnAtPmNuX25hbWVpb3AgPT0gREVMRVRFIHx8IGNucC0+Y25fbmFtZWlvcCA9PSBS
RU5BTUUpIHsKKwkJCWVycm9yID0gRUJVU1k7CisJCQlnb3RvIGJhZDsKKwkJfQorCQlpZiAoY25w
LT5jbl9uYW1laW9wID09IENSRUFURSkgeworCQkJZXJyb3IgPSBFRVhJU1Q7CisJCQlnb3RvIGJh
ZDsKKwkJfQorCQkvKiBYWFggVGhpcyBibG9jayBtaWdodCBub3QgYmUgbmVlZGVkLiAqLwogCQlp
ZiAoY25wLT5jbl9uYW1laW9wICE9IExPT0tVUCkgewogCQkJZXJyb3IgPSBFSVNESVI7CiAJCQln
b3RvIGJhZDsK

--+permail-2009110616430680e26a0b000006fe-a_best01+--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-2009110616430680e26a0b000006fe-a_best01>