From owner-freebsd-fs@FreeBSD.ORG Sun Dec 2 06:14:39 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8372016A420; Sun, 2 Dec 2007 06:14:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 2CC8C13C448; Sun, 2 Dec 2007 06:14:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1IyhrP-0004Dy-2L; Sun, 02 Dec 2007 07:59:23 +0200 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id lB25xK8m085144; Sun, 2 Dec 2007 07:59:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id lB25xJfN085143; Sun, 2 Dec 2007 07:59:19 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 2 Dec 2007 07:59:19 +0200 From: Kostik Belousov To: Don Lewis Message-ID: <20071202055919.GR83121@deviant.kiev.zoral.com.ua> References: <20071201215706.B12006@besplex.bde.org> <200712012207.lB1M7oNg015468@gw.catspoiler.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+Yg8W10oK6rlW0RR" Content-Disposition: inline In-Reply-To: <200712012207.lB1M7oNg015468@gw.catspoiler.org> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: efe3bc1504fa577d936f03857ce6b673 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1838 [Dec 01 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-fs@freebsd.org Subject: Re: File remove problem X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2007 06:14:39 -0000 --+Yg8W10oK6rlW0RR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 01, 2007 at 02:07:50PM -0800, Don Lewis wrote: > On 1 Dec, Bruce Evans wrote: > > On Sat, 1 Dec 2007, Kostik Belousov wrote: >=20 > >> +static int > >> +ffs_isronly(struct ufsmount *ump) > >> +{ > >> + struct fs *fs =3D ump->um_fs; > >> + > >> + return (fs->fs_ronly); > >> +} > >> + > >=20 > > Could be ump->um_fs->fs_ronly. >=20 > That's the change that I would have made. A #include for > would have to be added, which some might argue would be a layering > violation. I'd prefer to avoid the extra indirection. I would argue that the ufs already knows too much about the ffs. But, this seems to be the first explicit reference to the ffs from the ufs code. With your approval, see below. diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 448f436..22e29e9 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_inode.c,v 1.69 20= 07/06/22 13:22:37 kib E #ifdef UFS_GJOURNAL #include #endif +#include =20 /* * Last reference to an inode. If necessary, write or delete it. @@ -90,8 +91,7 @@ ufs_inactive(ap) ufs_gjournal_close(vp); #endif if ((ip->i_effnlink =3D=3D 0 && DOINGSOFTDEP(vp)) || - (ip->i_nlink <=3D 0 && - (vp->v_mount->mnt_flag & MNT_RDONLY) =3D=3D 0)) { + (ip->i_nlink <=3D 0 && !VFSTOUFS(mp)->um_fs->fs_ronly)) { loop: if (vn_start_secondary_write(vp, &mp, V_NOWAIT) !=3D 0) { /* Cannot delete file while file system is suspended */ @@ -121,7 +121,7 @@ ufs_inactive(ap) } if (ip->i_effnlink =3D=3D 0 && DOINGSOFTDEP(vp)) softdep_releasefile(ip); - if (ip->i_nlink <=3D 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) =3D=3D 0) { + if (ip->i_nlink <=3D 0 && !VFSTOUFS(mp)->um_fs->fs_ronly) { #ifdef QUOTA if (!getinoquota(ip)) (void)chkiq(ip, -1, NOCRED, FORCE); --+Yg8W10oK6rlW0RR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHUkm3C3+MBN1Mb4gRAiKBAJ9eJ0tNa94jZv9Aav5edNLWaiQsdwCg3GCV O1SqQzn7h0lN0eNywv/0qYg= =L+Fh -----END PGP SIGNATURE----- --+Yg8W10oK6rlW0RR--