Linux-kernel mailing list archive 1999-36,: [PATCH] nfsd generation number patch

# [PATCH] nfsd generation number patch

G. Allen Morris III (gam3@ixlabs.com)
Sun, 05 Sep 1999 20:12:51 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Rick Hohensee: "libsys for GNU/Linux"
- Previous message: tad-m2n@omoikane.co.jp: "Re: Fixing the SCSI layer"

This patch adds generation numbers to the nfs filehhandle.
While these are still not used, having them in the filehandle
now will make it easier to use them in the future. Also when
they are set by a filesystem they will solve the problems with
solaris (and other) clients cacheing and using filehandles that
should be stale.

Allen <gam3@ixlabs.com>

Index: fs/nfsd/nfsfh.c
===================================================================
RCS file: /home/cvs/cvsroot/linux-2.2/fs/nfsd/nfsfh.c,v
retrieving revision 1.1
diff -u -u -r1.1 nfsfh.c
--- fs/nfsd/nfsfh.c 1999/09/03 17:20:45 1.1
+++ fs/nfsd/nfsfh.c 1999/09/05 16:03:06
@@ -4,6 +4,7 @@
* NFS server file handle treatment.
*
* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
+ * Portions Copyright (C) 1999 G. Allen Morris III <gam3@acm.org>
*/
#include <linux/sched.h>
@@ -1192,6 +1193,7 @@
fhp->fh_handle.fh_dcookie = dentry;
if (inode) {
fhp->fh_handle.fh_ino = ino_t_to_u32(inode->i_ino);
+ fhp->fh_handle.fh_generation = inode->i_generation;
}
fhp->fh_handle.fh_dirino = ino_t_to_u32(parent->d_inode->i_ino);
fhp->fh_handle.fh_dev = kdev_t_to_u32(parent->d_inode->i_dev);
@@ -1223,6 +1225,7 @@
if (!inode)
goto out_negative;
fhp->fh_handle.fh_ino = ino_t_to_u32(inode->i_ino);
+ fhp->fh_handle.fh_generation = inode->i_generation;
out:
return;
Index: include/linux/nfsd/nfsfh.h
===================================================================
RCS file: /home/cvs/cvsroot/linux-2.2/include/linux/nfsd/nfsfh.h,v
retrieving revision 1.1
diff -u -u -r1.1 nfsfh.h
--- include/linux/nfsd/nfsfh.h 1999/09/03 17:20:46 1.1
+++ include/linux/nfsd/nfsfh.h 1999/09/05 18:21:01
@@ -8,7 +8,7 @@
* or SHA. I've removed this code, because it doesn't give you more
* security than blocking external access to port 2049 on your firewall.
*
- * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
+ * Copyright (C) 1995-1999 Olaf Kirch <okir@monad.swb.de>
*/
#ifndef NFSD_FH_H
@@ -33,6 +33,7 @@
__u32 fb_dev; /* our device */
__u32 fb_xdev;
__u32 fb_xino;
+ __u32 fb_generation;
};
#define NFS_FH_PADDING (NFS_FHSIZE - sizeof(struct nfs_fhbase))
@@ -47,6 +48,7 @@
#define fh_dev fh_base.fb_dev
#define fh_xdev fh_base.fb_xdev
#define fh_xino fh_base.fb_xino
+#define fh_generation fh_base.fb_generation
#ifdef __KERNEL__
@@ -179,34 +181,6 @@
up(&inode->i_sem);
}
}
-
-/*
- * Release an inode
- */
-#if 0
-#define fh_put(fhp) __fh_put(fhp, __FILE__, __LINE__)
-
-static inline void
-__fh_put(struct svc_fh *fhp, char *file, int line)
-{
- struct dentry *dentry;
-
- if (!fhp->fh_dverified)
- return;
-
- dentry = fhp->fh_dentry;
- if (!dentry->d_count) {
- printk("nfsd: trying to free free dentry in %s:%d\n"
- " file %s/%s\n",
- file, line,
- dentry->d_parent->d_name.name, dentry->d_name.name);
- } else {
- fh_unlock(fhp);
- fhp->fh_dverified = 0;
- dput(dentry);
- }
-}
-#endif
#endif /* __KERNEL__ */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Rick Hohensee: "libsys for GNU/Linux"
- Previous message: tad-m2n@omoikane.co.jp: "Re: Fixing the SCSI layer"