Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Dec 2007 07:59:19 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Don Lewis <truckman@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: File remove problem
Message-ID:  <20071202055919.GR83121@deviant.kiev.zoral.com.ua>
In-Reply-To: <200712012207.lB1M7oNg015468@gw.catspoiler.org>
References:  <20071201215706.B12006@besplex.bde.org> <200712012207.lB1M7oNg015468@gw.catspoiler.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--+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 <ufs/ffs/fs.h>
> 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 <ufs/ufs/gjournal.h>
 #endif
+#include <ufs/ffs/fs.h>
=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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071202055919.GR83121>