:
:From: Bruce Evans <[EMAIL PROTECTED]>
:> The kernel returns EROFS for unlink() without even looking up the last
:> component of the filename. This is a cosmetic bug IMO. The errors
:> listed in POSIX.1 are not required to be checked for in the given
:> order. However, checking in that order usually gives the most logical
:> results. For unlink() and similar syscalls, EROFS is at the end of
:> the list.
:
:I tried to fix this problem. I think it is very dirty code but it
:works to return ENOENT for "rm -rf" with read-only nfs mounted
:filesystem. Could someone clean up this?
The general idea seems sound enough. I'd rather wait until after
the release before putting this (or a similar patch) in, though,
since the bug isn't really all that serious.
I recommend submitting a PR for it and then emailing me the PR
number. I will assign it to myself so I don't forget and will
then patch it in after the release.
-Matt
Matthew Dillon
<[EMAIL PROTECTED]>
:
:
:Index: nfs_vnops.c
:===================================================================
:RCS file: /home/ncvs/src/sys/nfs/nfs_vnops.c,v
:retrieving revision 1.150
:diff -u -r1.150 nfs_vnops.c
:--- nfs_vnops.c 2000/01/05 00:32:18 1.150
:+++ nfs_vnops.c 2000/02/15 15:49:39
:@@ -820,9 +820,6 @@
: struct proc *p = cnp->cn_proc;
:
: *vpp = NULLVP;
:- if ((flags & ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
:- (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
:- return (EROFS);
: if (dvp->v_type != VDIR)
: return (ENOTDIR);
: lockparent = flags & LOCKPARENT;
:@@ -833,6 +830,11 @@
: struct vattr vattr;
: int vpid;
:
:+ if ((flags & ISLASTCN) &&
:+ (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
:+ (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
:+ return (EROFS);
:+
: if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, p)) != 0) {
: *vpp = NULLVP;
: return (error);
:@@ -894,6 +896,10 @@
: goto nfsmout;
: }
: nfsm_getfh(fhp, fhsize, v3);
:+
:+ if ((flags & ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
:+ (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
:+ return (EROFS);
:
: /*
: * Handle RENAME case...
:
:Jun Kuriyama // [EMAIL PROTECTED]
: // [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message