aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-09 09:34:19 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-09 09:34:19 -0400
commit8b4bdcf8995dd92b23d2ec22b32aee8fbbb50e1c (patch)
tree8ebe9ec2ed5cb58592097123cf6b34af997316c7
parent8b512d9a88875affe584bb3d2a7a235f84343b9e (diff)
NFS: Store the file system "fsid" value in the NFS super block.
This should enable us to detect if we are crossing a mountpoint in the case where the server is exporting "nohide" mounts. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/idmap.c1
-rw-r--r--fs/nfs/inode.c8
-rw-r--r--fs/nfs/nfs2xdr.c3
-rw-r--r--fs/nfs/nfs3xdr.c3
-rw-r--r--fs/nfs/nfs4xdr.c4
-rw-r--r--include/linux/nfs_fs.h5
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h19
9 files changed, 30 insertions, 15 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 3fab5b0cfc5a..b81e7ed3c902 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -47,7 +47,6 @@
47#include <linux/workqueue.h> 47#include <linux/workqueue.h>
48#include <linux/sunrpc/rpc_pipe_fs.h> 48#include <linux/sunrpc/rpc_pipe_fs.h>
49 49
50#include <linux/nfs_fs_sb.h>
51#include <linux/nfs_fs.h> 50#include <linux/nfs_fs.h>
52 51
53#include <linux/nfs_idmap.h> 52#include <linux/nfs_idmap.h>
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index fda2b4966179..1a809f6f8989 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -236,6 +236,7 @@ nfs_get_root(struct super_block *sb, struct nfs_fh *rootfh, struct nfs_fsinfo *f
236 return ERR_PTR(error); 236 return ERR_PTR(error);
237 } 237 }
238 238
239 server->fsid = fsinfo->fattr->fsid;
239 return nfs_fhget(sb, rootfh, fsinfo->fattr); 240 return nfs_fhget(sb, rootfh, fsinfo->fattr);
240} 241}
241 242
@@ -1493,6 +1494,7 @@ out:
1493 */ 1494 */
1494static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) 1495static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1495{ 1496{
1497 struct nfs_server *server;
1496 struct nfs_inode *nfsi = NFS_I(inode); 1498 struct nfs_inode *nfsi = NFS_I(inode);
1497 loff_t cur_isize, new_isize; 1499 loff_t cur_isize, new_isize;
1498 unsigned int invalid = 0; 1500 unsigned int invalid = 0;
@@ -1511,6 +1513,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1511 if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) 1513 if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT))
1512 goto out_changed; 1514 goto out_changed;
1513 1515
1516 server = NFS_SERVER(inode);
1517 /* Update the fsid if and only if this is the root directory */
1518 if (inode == inode->i_sb->s_root->d_inode
1519 && !nfs_fsid_equal(&server->fsid, &fattr->fsid))
1520 server->fsid = fattr->fsid;
1521
1514 /* 1522 /*
1515 * Update the read time so we don't revalidate too often. 1523 * Update the read time so we don't revalidate too often.
1516 */ 1524 */
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index f0015fa876e1..a7ed88f97a11 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -131,7 +131,8 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
131 fattr->du.nfs2.blocksize = ntohl(*p++); 131 fattr->du.nfs2.blocksize = ntohl(*p++);
132 rdev = ntohl(*p++); 132 rdev = ntohl(*p++);
133 fattr->du.nfs2.blocks = ntohl(*p++); 133 fattr->du.nfs2.blocks = ntohl(*p++);
134 fattr->fsid_u.nfs3 = ntohl(*p++); 134 fattr->fsid.major = ntohl(*p++);
135 fattr->fsid.minor = 0;
135 fattr->fileid = ntohl(*p++); 136 fattr->fileid = ntohl(*p++);
136 p = xdr_decode_time(p, &fattr->atime); 137 p = xdr_decode_time(p, &fattr->atime);
137 p = xdr_decode_time(p, &fattr->mtime); 138 p = xdr_decode_time(p, &fattr->mtime);
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index ec233619687e..f70eee2cac05 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -166,7 +166,8 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
166 if (MAJOR(fattr->rdev) != major || MINOR(fattr->rdev) != minor) 166 if (MAJOR(fattr->rdev) != major || MINOR(fattr->rdev) != minor)
167 fattr->rdev = 0; 167 fattr->rdev = 0;
168 168
169 p = xdr_decode_hyper(p, &fattr->fsid_u.nfs3); 169 p = xdr_decode_hyper(p, &fattr->fsid.major);
170 fattr->fsid.minor = 0;
170 p = xdr_decode_hyper(p, &fattr->fileid); 171 p = xdr_decode_hyper(p, &fattr->fileid);
171 p = xdr_decode_time3(p, &fattr->atime); 172 p = xdr_decode_time3(p, &fattr->atime);
172 p = xdr_decode_time3(p, &fattr->mtime); 173 p = xdr_decode_time3(p, &fattr->mtime);
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 7e9a840057f2..0d5794675944 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2217,7 +2217,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
2217 return 0; 2217 return 0;
2218} 2218}
2219 2219
2220static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fsid *fsid) 2220static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid)
2221{ 2221{
2222 uint32_t *p; 2222 uint32_t *p;
2223 2223
@@ -2863,7 +2863,7 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons
2863 goto xdr_error; 2863 goto xdr_error;
2864 if ((status = decode_attr_size(xdr, bitmap, &fattr->size)) != 0) 2864 if ((status = decode_attr_size(xdr, bitmap, &fattr->size)) != 0)
2865 goto xdr_error; 2865 goto xdr_error;
2866 if ((status = decode_attr_fsid(xdr, bitmap, &fattr->fsid_u.nfs4)) != 0) 2866 if ((status = decode_attr_fsid(xdr, bitmap, &fattr->fsid)) != 0)
2867 goto xdr_error; 2867 goto xdr_error;
2868 if ((status = decode_attr_fileid(xdr, bitmap, &fattr->fileid)) != 0) 2868 if ((status = decode_attr_fileid(xdr, bitmap, &fattr->fileid)) != 0)
2869 goto xdr_error; 2869 goto xdr_error;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fc48135621ed..6763a0089ee4 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -16,8 +16,6 @@
16#include <linux/rwsem.h> 16#include <linux/rwsem.h>
17#include <linux/wait.h> 17#include <linux/wait.h>
18 18
19#include <linux/nfs_fs_sb.h>
20
21#include <linux/sunrpc/debug.h> 19#include <linux/sunrpc/debug.h>
22#include <linux/sunrpc/auth.h> 20#include <linux/sunrpc/auth.h>
23#include <linux/sunrpc/clnt.h> 21#include <linux/sunrpc/clnt.h>
@@ -27,6 +25,9 @@
27#include <linux/nfs3.h> 25#include <linux/nfs3.h>
28#include <linux/nfs4.h> 26#include <linux/nfs4.h>
29#include <linux/nfs_xdr.h> 27#include <linux/nfs_xdr.h>
28
29#include <linux/nfs_fs_sb.h>
30
30#include <linux/rwsem.h> 31#include <linux/rwsem.h>
31#include <linux/mempool.h> 32#include <linux/mempool.h>
32 33
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 65dec21af774..6b4a13c79474 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -35,6 +35,7 @@ struct nfs_server {
35 char * hostname; /* remote hostname */ 35 char * hostname; /* remote hostname */
36 struct nfs_fh fh; 36 struct nfs_fh fh;
37 struct sockaddr_in addr; 37 struct sockaddr_in addr;
38 struct nfs_fsid fsid;
38 unsigned long mount_time; /* when this fs was mounted */ 39 unsigned long mount_time; /* when this fs was mounted */
39#ifdef CONFIG_NFS_V4 40#ifdef CONFIG_NFS_V4
40 /* Our own IP address, as a null-terminated string. 41 /* Our own IP address, as a null-terminated string.
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 8cadb0a77a7a..1f7bd287c230 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -13,7 +13,6 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/nfs_fs_sb.h>
17#include <linux/sunrpc/auth.h> 16#include <linux/sunrpc/auth.h>
18#include <linux/nfs_xdr.h> 17#include <linux/nfs_xdr.h>
19 18
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index e206c07080fe..95682f7d738a 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -14,11 +14,19 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 15#define NFS_MIN_FILE_IO_SIZE (1024U)
16 16
17struct nfs4_fsid { 17struct nfs_fsid {
18 __u64 major; 18 uint64_t major;
19 __u64 minor; 19 uint64_t minor;
20}; 20};
21 21
22/*
23 * Helper for checking equality between 2 fsids.
24 */
25static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
26{
27 return a->major == b->major && a->minor == b->minor;
28}
29
22struct nfs_fattr { 30struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */ 31 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */ 32 __u64 pre_size; /* pre_op_attr.size */
@@ -40,10 +48,7 @@ struct nfs_fattr {
40 } nfs3; 48 } nfs3;
41 } du; 49 } du;
42 dev_t rdev; 50 dev_t rdev;
43 union { 51 struct nfs_fsid fsid;
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid; 52 __u64 fileid;
48 struct timespec atime; 53 struct timespec atime;
49 struct timespec mtime; 54 struct timespec mtime;