Date: Fri, 18 Feb 2000 19:11:04 -0800 (PST) From: kuriyama@FreeBSD.org To: freebsd-gnats-submit@FreeBSD.org Subject: kern/16815: Cannot "rm -rf" for not-existed file on read-only nfs Message-ID: <200002190311.TAA47092@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 16815
>Category: kern
>Synopsis: Cannot "rm -rf" for not-existed file on read-only nfs
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 18 19:20:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Jun Kuriyama
>Release: 4.0-CURRENT
>Organization:
FreeBSD Project
>Environment:
FreeBSD leda.sky.rim.or.jp 4.0-CURRENT FreeBSD 4.0-CURRENT #181: Sat Feb 19 11:03:55 JST 2000 junk@leda.sky.rim.or.jp:/home/junk/ncvs/src/sys/compile/NM i386
>Description:
On nfs read-only mounted filesystem, you cannot "rm -rf" for not-existed file (or directory).
Kernel should not return EROFS at that case.
>How-To-Repeat:
% rm /usr/bin/a
rm: /usr/bin/a: No such file or directory
% rm -f /usr/bin/a
% rm -rf /usr/bin/a
% rm /usr/src/a
rm: /usr/src/a: No such file or directory
% rm -f /usr/src/a
% rm -rf /usr/src/a
rm: /usr/src/a: Read-only file system
%
>Fix:
Sorry, this may be broken because copy/paste space/tab issue.
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...
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002190311.TAA47092>
