NetBSD Problem Report #42246

From nakayosh@leto.eonet.ne.jp  Thu Oct 29 16:20:49 2009
Return-Path: <nakayosh@leto.eonet.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 87F0663B877
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Oct 2009 16:20:49 +0000 (UTC)
Message-Id: <20091029141434.D49191AF2BB@ae0000-mailauth14.eo.k-opti.ad.jp>
Date: Thu, 29 Oct 2009 23:14:34 +0900 (JST)
From: nakayosh@leto.eonet.ne.jp
Reply-To: nakayosh@leto.eonet.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Subject: COMPAT_50 for LFS
X-Send-Pr-Version: 3.95

>Number:         42246
>Category:       kern
>Synopsis:       COMPAT_50 for LFS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 29 16:25:00 +0000 2009
>Closed-Date:    Fri Oct 30 01:09:54 +0000 2009
>Last-Modified:  Fri Oct 30 01:09:54 +0000 2009
>Originator:     NAKAJIMA Yoshihiro
>Release:        NetBSD-current/20091023
>Organization:
>Environment:
System: NetBSD vajra 5.99.21 NetBSD 5.99.21 (VAJRA) #3: Thu Oct 29 00:21:13 JST 2009 nakayosh@vajra:/usr/src/sys/arch/i386/compile/VAJRA i386
Architecture: i386
Machine: i386
>Description:

NetBSD-current doesn't support COMPAT_50 for LFS.

>How-To-Repeat:
>Fix:

This provides COMPAT_50 for LFS,
allows disabling COMPAT_[2-4]0,
and doesn't provide COMPAT_1*.

Date: Thu Oct 29 23:08:29 JST 2009
diff -u src/sys/ufs/lfs/lfs.h.ORIG src/sys/ufs/lfs/lfs.h
--- src/sys/ufs/lfs/lfs.h.ORIG	2009-07-19 12:39:14.000000000 +0900
+++ src/sys/ufs/lfs/lfs.h	2009-10-29 23:01:27.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.128 2009/07/19 03:39:14 dholland Exp $	*/
+/*	$NetBSD$	*/

 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -66,6 +66,9 @@
 #include <sys/mutex.h>
 #include <sys/queue.h>
 #include <sys/condvar.h>
+#ifdef COMPAT_50
+#include <compat/sys/time.h>
+#endif

 /*
  * Compile-time options for LFS.
@@ -1081,8 +1084,8 @@
 	int blkcnt;		/* number of blocks */
 };

-#define LFCNSEGWAITALL	 _FCNR_FSPRIV('L', 0, struct timeval)
-#define LFCNSEGWAIT	 _FCNR_FSPRIV('L', 1, struct timeval)
+#define LFCNSEGWAITALL	_FCNR_FSPRIV('L', 14, struct timeval)
+#define LFCNSEGWAIT	_FCNR_FSPRIV('L', 15, struct timeval)
 #define LFCNBMAPV	_FCNRW_FSPRIV('L', 2, struct lfs_fcntl_markv)
 #define LFCNMARKV	_FCNRW_FSPRIV('L', 3, struct lfs_fcntl_markv)
 #define LFCNRECLAIM	 _FCNO_FSPRIV('L', 4)
@@ -1101,12 +1104,22 @@
 # define LFS_WRAP_WAITING 0x1
 #define LFCNWRAPSTATUS	 _FCNW_FSPRIV('L', 13, int)
 /* Compat */
-#define LFCNSEGWAITALL_COMPAT	 _FCNW_FSPRIV('L', 0, struct timeval)
-#define LFCNSEGWAIT_COMPAT	 _FCNW_FSPRIV('L', 1, struct timeval)
+#ifdef COMPAT_20
+#define LFCNSEGWAITALL_COMPAT	_FCNW_FSPRIV('L', 0, struct timeval50)
+#define LFCNSEGWAIT_COMPAT	_FCNW_FSPRIV('L', 1, struct timeval50)
+#endif
+#ifdef COMPAT_30
 #define LFCNIFILEFH_COMPAT	 _FCNW_FSPRIV('L', 5, struct lfs_fhandle)
+#endif
+#ifdef COMPAT_40
 #define LFCNIFILEFH_COMPAT2	 _FCN_FSPRIV(F_FSOUT, 'L', 11, 32)
 #define LFCNWRAPSTOP_COMPAT	 _FCNO_FSPRIV('L', 9)
 #define LFCNWRAPGO_COMPAT	 _FCNO_FSPRIV('L', 10)
+#endif
+#ifdef COMPAT_50
+#define LFCNSEGWAITALL_COMPAT_50 _FCNR_FSPRIV('L', 0, struct timeval50)
+#define LFCNSEGWAIT_COMPAT_50	 _FCNR_FSPRIV('L', 1, struct timeval50)
+#endif

 #ifdef _KERNEL
 /* XXX MP */
diff -u src/sys/ufs/lfs/lfs_vnops.c.ORIG src/sys/ufs/lfs/lfs_vnops.c
--- src/sys/ufs/lfs/lfs_vnops.c.ORIG	2009-05-08 05:32:51.000000000 +0900
+++ src/sys/ufs/lfs/lfs_vnops.c	2009-10-29 23:04:38.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vnops.c,v 1.221 2009/05/07 20:32:51 elad Exp $	*/
+/*	$NetBSD$	*/

 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -1426,6 +1426,9 @@
 		int  a_fflag;
 		kauth_cred_t a_cred;
 	} */ *ap = v;
+#ifdef COMPAT_50
+	struct timeval tv;
+#endif
 	struct timeval *tvp;
 	BLOCK_INFO *blkiov;
 	CLEANERINFO *cip;
@@ -1463,13 +1466,31 @@

 	error = 0;
 	switch ((int)ap->a_command) {
-	    case LFCNSEGWAITALL:
+#ifdef COMPAT_50
+	    case LFCNSEGWAITALL_COMPAT_50:
+#ifdef COMPAT_20
 	    case LFCNSEGWAITALL_COMPAT:
+#endif
 		fsidp = NULL;
 		/* FALLSTHROUGH */
-	    case LFCNSEGWAIT:
+	    case LFCNSEGWAIT_COMPAT_50:
+#ifdef COMPAT_20
 	    case LFCNSEGWAIT_COMPAT:
+#endif
+		{
+			struct timeval50 *tvp50
+				= (struct timeval50 *)ap->a_data;
+			timeval50_to_timeval(tvp50, &tv);
+			tvp = &tv;
+		}
+		goto segwait_common;
+#endif /* COMPAT_50 */
+	    case LFCNSEGWAITALL:
+		fsidp = NULL;
+		/* FALLSTHROUGH */
+	    case LFCNSEGWAIT:
 		tvp = (struct timeval *)ap->a_data;
+segwait_common:
 		mutex_enter(&lfs_lock);
 		++fs->lfs_sleepers;
 		mutex_exit(&lfs_lock);
@@ -1553,7 +1574,9 @@
 		return lfs_vptofh(fs->lfs_ivnode, &(fhp->fh_fid), &fh_size);
 #endif

+#ifdef COMPAT_40
 	    case LFCNIFILEFH_COMPAT2:
+#endif
 	    case LFCNIFILEFH:
 		/* Return the filehandle of the Ifile */
 		fhp = (struct fhandle *)ap->a_data;
@@ -1583,7 +1606,9 @@
 		return lfs_resize_fs(fs, *(int *)ap->a_data);

 	    case LFCNWRAPSTOP:
+#ifdef COMPAT_40
 	    case LFCNWRAPSTOP_COMPAT:
+#endif
 		/*
 		 * Hold lfs_newseg at segment 0; if requested, sleep until
 		 * the filesystem wraps around.  To support external agents
@@ -1601,8 +1626,11 @@
 		if (fs->lfs_nowrap == 0)
 			log(LOG_NOTICE, "%s: disabled log wrap\n", fs->lfs_fsmnt);
 		++fs->lfs_nowrap;
-		if (*(int *)ap->a_data == 1 ||
-		    ap->a_command == LFCNWRAPSTOP_COMPAT) {
+		if (*(int *)ap->a_data == 1
+#ifdef COMPAT_40
+		    || ap->a_command == LFCNWRAPSTOP_COMPAT
+#endif
+							   ) {
 			log(LOG_NOTICE, "LFCNSTOPWRAP waiting for log wrap\n");
 			error = mtsleep(&fs->lfs_nowrap, PCATCH | PUSER,
 				"segwrap", 0, &lfs_lock);
@@ -1615,7 +1643,9 @@
 		return 0;

 	    case LFCNWRAPGO:
+#ifdef COMPAT_40
 	    case LFCNWRAPGO_COMPAT:
+#endif
 		/*
 		 * Having done its work, the agent wakes up the writer.
 		 * If the argument is 1, it sleeps until a new segment
@@ -1623,8 +1653,10 @@
 		 */
 		mutex_enter(&lfs_lock);
 		error = lfs_wrapgo(fs, VTOI(ap->a_vp),
-				   (ap->a_command == LFCNWRAPGO_COMPAT ? 1 :
-				    *((int *)ap->a_data)));
+#ifdef COMPAT_40
+				   ap->a_command == LFCNWRAPGO_COMPAT ? 1 :
+#endif
+				    *((int *)ap->a_data));
 		mutex_exit(&lfs_lock);
 		return error;


>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42246 CVS commit: src/sys/ufs/lfs
Date: Thu, 29 Oct 2009 13:10:32 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Oct 29 17:10:32 UTC 2009

 Modified Files:
 	src/sys/ufs/lfs: lfs.h lfs_vnops.c

 Log Message:
 PR/42246: NAKAJIMA Yoshihiro: provide COMPAT_50 for LFS


 To generate a diff of this commit:
 cvs rdiff -u -r1.128 -r1.129 src/sys/ufs/lfs/lfs.h
 cvs rdiff -u -r1.221 -r1.222 src/sys/ufs/lfs/lfs_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Thu, 29 Oct 2009 21:09:54 -0400
State-Changed-Why:
fixed, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.