rpms/util-linux/devel util-linux-2.13-nfsmount-fsc.patch, NONE, 1.1.4.1 util-linux.spec, 1.117, 1.117.2.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jun 8 18:07:39 UTC 2006


Author: steved

Update of /cvs/dist/rpms/util-linux/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13325

Modified Files:
      Tag: private-util-linux-2-13-0-24-nfsmount_fsc
	util-linux.spec 
Added Files:
      Tag: private-util-linux-2-13-0-24-nfsmount_fsc
	util-linux-2.13-nfsmount-fsc.patch 
Log Message:
Added the Filsystem Caching (-o fsc) option to the nfs/nfs4 mounts


util-linux-2.13-nfsmount-fsc.patch:
 nfs.5        |    8 ++++++++
 nfs4_mount.h |    1 +
 nfs4mount.c  |   28 +++++++++++++++++++++++++---
 nfs_mount4.h |    1 +
 nfsmount.c   |   31 +++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+), 3 deletions(-)

--- NEW FILE util-linux-2.13-nfsmount-fsc.patch ---
--- util-linux-2.13-pre6/mount/nfs_mount4.h.fsc	2006-05-24 18:41:24.000000000 -0400
+++ util-linux-2.13-pre6/mount/nfs_mount4.h	2006-05-24 18:42:54.000000000 -0400
@@ -58,6 +58,7 @@ struct nfs_mount_data {
 #define NFS_MOUNT_BROKEN_SUID	0x0400	/* 4 */
 #define NFS_MOUNT_NOACL     0x0800  /* 4 */
 #define NFS_MOUNT_SECFLAVOUR	0x2000	/* 5 */
+#define NFS_MOUNT_FSCACHE		0x4000
 
 /* security pseudoflavors */
 
--- util-linux-2.13-pre6/mount/nfsmount.c.fsc	2006-05-24 18:41:24.000000000 -0400
+++ util-linux-2.13-pre6/mount/nfsmount.c	2006-05-24 18:43:38.000000000 -0400
@@ -51,6 +51,7 @@
 #include <mntent.h>
 #include <paths.h>
 #include <syslog.h>
+#include <asm/unistd.h>
 
 #include "sundries.h"
 #include "nfsmount.h"
@@ -173,6 +174,15 @@ void mount_errors(char *server, int will
 	} else
 		fprintf(stderr, "%s.\n", errbuf);
 }
+#ifndef KEY_SPEC_THREAD_KEYRING
+#define KEY_SPEC_THREAD_KEYRING -1
+#endif
+int nfs_add_key(char *des, char *payload, size_t plen)
+{
+	return syscall(__NR_add_key, "user", 
+		des, payload, plen, KEY_SPEC_THREAD_KEYRING);
+}
+static char *fsctag = NULL;
 
 /* Define the order in which to probe for UDP/TCP services */
 enum plist {
@@ -883,6 +893,15 @@ parse_options(char *old_opts, struct nfs
 					goto bad_parameter;
  				}
  				strncpy(data->context, context, NFS_MAX_CONTEXT_LEN);
+			 } else if (!strcmp(opt, "fsctag")) {
+ 				char *tmp = opteq + 1;
+ 				
+ 				if (strlen(tmp) > BUFSIZ) {
+ 					printf(_("fsctag parameter exceeds limit of %d\n"),
+ 						 BUFSIZ);
+					goto bad_parameter;
+ 				}
+ 				fsctag = strdup(tmp);
  			} else if (!sloppy)
 				goto bad_parameter;
 			sprintf(cbuf, "%s=%s,", opt, opteq+1);
@@ -900,6 +919,10 @@ parse_options(char *old_opts, struct nfs
 				data->flags &= ~NFS_MOUNT_SOFT;
 				if (val)
 					data->flags |= NFS_MOUNT_SOFT;
+			} else if (!strcmp(opt, "fsc")) {
+				data->flags &= ~NFS_MOUNT_FSCACHE;
+				if (val)
+					data->flags |= NFS_MOUNT_FSCACHE;
 			} else if (!strcmp(opt, "hard")) {
 				data->flags &= ~NFS_MOUNT_SOFT;
 				if (!val)
@@ -1378,6 +1401,14 @@ noauth_flavours:
 				  "excessively long option argument\n"));
 		goto fail;
 	}
+	if (data.flags & NFS_MOUNT_FSCACHE) {
+		char *tmp = fsctag ? fsctag : node;
+
+		val = nfs_add_key("mount:nfs:fsctag", tmp, strlen(tmp)+1);
+		if (val < 0)
+			fprintf(stderr, "mount: Warning: Unable to set fsctag:"
+				"error: %d (%s)\n", errno, strerror(errno));
+	}
 
 	snprintf(cbuf, sizeof(cbuf)-1, "addr=%s", s);
 	strcat(new_opts, cbuf);
--- util-linux-2.13-pre6/mount/nfs4mount.c.fsc	2006-05-24 18:41:24.000000000 -0400
+++ util-linux-2.13-pre6/mount/nfs4mount.c	2006-05-24 18:44:32.000000000 -0400
@@ -78,6 +78,9 @@ char *GSSDLCK = DEFAULT_DIR "/rpcgssd";
 
 extern int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
 extern void mount_errors(char *, int, int);
+extern void rpc_strerror(void);
+extern int nfs_add_key(char *des, char *payload, size_t plen);
+static char *fsctag = NULL;
 
 struct {
 	char    *flavour;
@@ -205,10 +208,10 @@ int nfs4mount(const char *spec, const ch
 	char *hostname, *dirname, *old_opts;
 	char new_opts[1024];
 	char *opt, *opteq;
-	char *s;
+	char *s, *tmp;
 	int val;
 	int bg, soft, intr;
-	int nocto, noac;
+	int nocto, noac, fscache;
 	int retry;
 	int retval;
 	time_t timeout, t;
@@ -259,6 +262,7 @@ int nfs4mount(const char *spec, const ch
 	intr = NFS4_MOUNT_INTR;
 	nocto = 0;
 	noac = 0;
+	fscache = 0;
 	retry = 10000;		/* 10000 minutes ~ 1 week */
 
 	/*
@@ -315,6 +319,14 @@ int nfs4mount(const char *spec, const ch
 				num_flavour = parse_sec(opteq+1, pseudoflavour);
 				if (!num_flavour)
 					goto fail;
+			 } else if (!strcmp(opt, "fsctag")) {
+ 				tmp = opteq + 1;
+ 				if (strlen(tmp) > BUFSIZ) {
+ 					printf(_("fsctag parameter exceeds limit of %d\n"),
+ 						 BUFSIZ);
+					goto fail;
+ 				}
+ 				fsctag = strdup(tmp);
 			} else if (!strcmp(opt, "addr")) {
 				/* ignore */;
 			} else {
@@ -338,6 +350,8 @@ int nfs4mount(const char *spec, const ch
 				soft = !val;
 			else if (!strcmp(opt, "intr"))
 				intr = val;
+			else if (!strcmp(opt, "fsc"))
+				fscache = val;
 			else if (!strcmp(opt, "cto"))
 				nocto = !val;
 			else if (!strcmp(opt, "ac"))
@@ -355,7 +369,8 @@ int nfs4mount(const char *spec, const ch
 	data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
 		| (intr ? NFS4_MOUNT_INTR : 0)
 		| (nocto ? NFS4_MOUNT_NOCTO : 0)
-		| (noac ? NFS4_MOUNT_NOAC : 0);
+		| (noac ? NFS4_MOUNT_NOAC : 0)
+		| (fscache ? NFS4_MOUNT_FSCACHE : 0);
 
 	/*
 	 * Give a warning if the rpc.idmapd daemon is not running
@@ -445,6 +460,13 @@ int nfs4mount(const char *spec, const ch
 		mount_errors(hostname, 1, bg);
 		continue;
 	}
+	if (data.flags & NFS4_MOUNT_FSCACHE) {
+		tmp = fsctag ? fsctag : (char *)node;
+		val = nfs_add_key("mount:nfs4:fsctag", tmp, strlen(tmp)+1);
+		if (val < 0)
+			fprintf(stderr, "mount: Warning: Unable to set fsctag:"
+				"error: %d (%s)\n", errno, strerror(errno));
+	}
 
 	*mount_opts = (char *) &data;
 	/* clean up */
--- util-linux-2.13-pre6/mount/nfs4_mount.h.fsc	2006-05-24 18:41:21.000000000 -0400
+++ util-linux-2.13-pre6/mount/nfs4_mount.h	2006-05-24 18:42:55.000000000 -0400
@@ -65,6 +65,7 @@ struct nfs4_mount_data {
 #define NFS4_MOUNT_NOCTO	0x0010	/* 1 */
 #define NFS4_MOUNT_NOAC		0x0020	/* 1 */
 #define NFS4_MOUNT_STRICTLOCK	0x1000	/* 1 */
+#define NFS4_MOUNT_FSCACHE		0x4000	/* 1 */
 #define NFS4_MOUNT_FLAGMASK	0xFFFF
 
 /* pseudoflavors: */
--- util-linux-2.13-pre6/mount/nfs.5.fsc	2006-05-24 18:41:24.000000000 -0400
+++ util-linux-2.13-pre6/mount/nfs.5	2006-05-24 18:42:55.000000000 -0400
@@ -272,6 +272,10 @@ default UDP protocol.  Many NFS servers 
 .I udp
 Mount the NFS filesystem using the UDP protocol.  This
 is the default.
+.TP 1.5i
+.I fsc
+Unable the use of persistent caching to the local disk using 
+the FS-Cache facility for the given mount point. 
 .P
 All of the non-value options have corresponding nooption forms.
 For example, nointr means don't allow file operations to be
@@ -428,6 +432,10 @@ This extracts a
 server performance penalty but it allows two different NFS clients
 to get reasonable good results when both clients are actively
 writing to common filesystem on the server.
+.TP 1.5i
+.I fsc
+Unable the use of persistent caching to the local disk using 
+the FS-Cache facility for the given mount point. 
 .P
 All of the non-value options have corresponding nooption forms.
 For example, nointr means don't allow file operations to be


Index: util-linux.spec
===================================================================
RCS file: /cvs/dist/rpms/util-linux/devel/util-linux.spec,v
retrieving revision 1.117
retrieving revision 1.117.2.1
diff -u -r1.117 -r1.117.2.1
--- util-linux.spec	25 May 2006 19:39:35 -0000	1.117
+++ util-linux.spec	8 Jun 2006 18:07:23 -0000	1.117.2.1
@@ -25,7 +25,7 @@
 Summary: A collection of basic system utilities.
 Name: util-linux
 Version: 2.13
-Release: 0.24
+Release: 0.24.fsc
 License: distributable
 Group: System Environment/Base
 
@@ -189,6 +189,7 @@
 # Adds syslog logging to background mounts
 Patch232: util-linux-2.13-nfsmount-syslog.patch
 
+Patch400: util-linux-2.13-nfsmount-fsc.patch
 
 # When adding patches, please make sure that it is easy to find out what bug # the 
 # patch fixes.
@@ -274,6 +275,8 @@
 %patch231 -p1
 %patch232 -p1
 
+%patch400 -p1
+
 %build
 unset LINGUAS || :
 
@@ -658,6 +661,9 @@
 /sbin/losetup
 
 %changelog
+* Thu Jun  8 2006 Steve Dickson <steved at redhat.com> 2.13-0.24.fsc
+- Added the Filsystem Caching (-o fsc) option to the nfs/nfs4 mounts
+
 * Wed May 24 2006 Dan Walsh <dwalsh at RedHat.com> 2.13-0.24
 - Remove requirement on restorecon, since we can do the same thing
 - with chcon/matchpathcon, and not add requirement on policycoreutils




More information about the fedora-cvs-commits mailing list