aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-02-06 22:05:13 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-06 22:05:13 -0500
commit8423200553113cc031caa9b147f6150a8e26545c (patch)
tree752c93a200c9ba056c7469c96f7e27d02c99291d /fs/nfsd
parentf03e64f2ca6ee3d0b7824536b1940497701fe766 (diff)
parent62d0cfcb27cf755cebdc93ca95dabc83608007cd (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/export.c1
-rw-r--r--fs/nfsd/nfs3xdr.c9
-rw-r--r--fs/nfsd/nfs4xdr.c5
-rw-r--r--fs/nfsd/nfsfh.c14
-rw-r--r--fs/nfsd/nfssvc.c8
-rw-r--r--fs/nfsd/nfsxdr.c5
-rw-r--r--fs/nfsd/vfs.c29
7 files changed, 30 insertions, 41 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 248dd92e6a56..49c310b84923 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -35,7 +35,6 @@
35#include <linux/lockd/bind.h> 35#include <linux/lockd/bind.h>
36 36
37#define NFSDDBG_FACILITY NFSDDBG_EXPORT 37#define NFSDDBG_FACILITY NFSDDBG_EXPORT
38#define NFSD_PARANOIA 1
39 38
40typedef struct auth_domain svc_client; 39typedef struct auth_domain svc_client;
41typedef struct svc_export svc_export; 40typedef struct svc_export svc_export;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 277df40f098d..e695660921ec 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -990,15 +990,16 @@ encode_entry(struct readdir_cd *ccd, const char *name,
990} 990}
991 991
992int 992int
993nfs3svc_encode_entry(struct readdir_cd *cd, const char *name, 993nfs3svc_encode_entry(void *cd, const char *name,
994 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 994 int namlen, loff_t offset, u64 ino, unsigned int d_type)
995{ 995{
996 return encode_entry(cd, name, namlen, offset, ino, d_type, 0); 996 return encode_entry(cd, name, namlen, offset, ino, d_type, 0);
997} 997}
998 998
999int 999int
1000nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, 1000nfs3svc_encode_entry_plus(void *cd, const char *name,
1001 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 1001 int namlen, loff_t offset, u64 ino,
1002 unsigned int d_type)
1002{ 1003{
1003 return encode_entry(cd, name, namlen, offset, ino, d_type, 1); 1004 return encode_entry(cd, name, namlen, offset, ino, d_type, 1);
1004} 1005}
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index fea46368afb2..18aa9440df14 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1880,9 +1880,10 @@ nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
1880} 1880}
1881 1881
1882static int 1882static int
1883nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen, 1883nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
1884 loff_t offset, ino_t ino, unsigned int d_type) 1884 loff_t offset, u64 ino, unsigned int d_type)
1885{ 1885{
1886 struct readdir_cd *ccd = ccdv;
1886 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); 1887 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
1887 int buflen; 1888 int buflen;
1888 __be32 *p = cd->buffer; 1889 __be32 *p = cd->buffer;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index b06bf9f70efc..c59d6fbb7a6b 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -24,8 +24,6 @@
24#include <linux/nfsd/nfsd.h> 24#include <linux/nfsd/nfsd.h>
25 25
26#define NFSDDBG_FACILITY NFSDDBG_FH 26#define NFSDDBG_FACILITY NFSDDBG_FH
27#define NFSD_PARANOIA 1
28/* #define NFSD_DEBUG_VERBOSE 1 */
29 27
30 28
31static int nfsd_nr_verified; 29static int nfsd_nr_verified;
@@ -230,13 +228,12 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
230 error = nfserrno(PTR_ERR(dentry)); 228 error = nfserrno(PTR_ERR(dentry));
231 goto out; 229 goto out;
232 } 230 }
233#ifdef NFSD_PARANOIA 231
234 if (S_ISDIR(dentry->d_inode->i_mode) && 232 if (S_ISDIR(dentry->d_inode->i_mode) &&
235 (dentry->d_flags & DCACHE_DISCONNECTED)) { 233 (dentry->d_flags & DCACHE_DISCONNECTED)) {
236 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", 234 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n",
237 dentry->d_parent->d_name.name, dentry->d_name.name); 235 dentry->d_parent->d_name.name, dentry->d_name.name);
238 } 236 }
239#endif
240 237
241 fhp->fh_dentry = dentry; 238 fhp->fh_dentry = dentry;
242 fhp->fh_export = exp; 239 fhp->fh_export = exp;
@@ -267,12 +264,13 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
267 /* Finally, check access permissions. */ 264 /* Finally, check access permissions. */
268 error = nfsd_permission(exp, dentry, access); 265 error = nfsd_permission(exp, dentry, access);
269 266
270#ifdef NFSD_PARANOIA_EXTREME
271 if (error) { 267 if (error) {
272 printk("fh_verify: %s/%s permission failure, acc=%x, error=%d\n", 268 dprintk("fh_verify: %s/%s permission failure, "
273 dentry->d_parent->d_name.name, dentry->d_name.name, access, (error >> 24)); 269 "acc=%x, error=%d\n",
270 dentry->d_parent->d_name.name,
271 dentry->d_name.name,
272 access, ntohl(error));
274 } 273 }
275#endif
276out: 274out:
277 if (exp && !IS_ERR(exp)) 275 if (exp && !IS_ERR(exp))
278 exp_put(exp); 276 exp_put(exp);
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 0aaccb03bf76..fbf5d51947ea 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -72,7 +72,7 @@ static struct svc_program nfsd_acl_program = {
72 .pg_prog = NFS_ACL_PROGRAM, 72 .pg_prog = NFS_ACL_PROGRAM,
73 .pg_nvers = NFSD_ACL_NRVERS, 73 .pg_nvers = NFSD_ACL_NRVERS,
74 .pg_vers = nfsd_acl_versions, 74 .pg_vers = nfsd_acl_versions,
75 .pg_name = "nfsd", 75 .pg_name = "nfsacl",
76 .pg_class = "nfsd", 76 .pg_class = "nfsd",
77 .pg_stats = &nfsd_acl_svcstats, 77 .pg_stats = &nfsd_acl_svcstats,
78 .pg_authenticate = &svc_set_client, 78 .pg_authenticate = &svc_set_client,
@@ -118,16 +118,16 @@ int nfsd_vers(int vers, enum vers_op change)
118 switch(change) { 118 switch(change) {
119 case NFSD_SET: 119 case NFSD_SET:
120 nfsd_versions[vers] = nfsd_version[vers]; 120 nfsd_versions[vers] = nfsd_version[vers];
121 break;
122#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 121#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
123 if (vers < NFSD_ACL_NRVERS) 122 if (vers < NFSD_ACL_NRVERS)
124 nfsd_acl_version[vers] = nfsd_acl_version[vers]; 123 nfsd_acl_versions[vers] = nfsd_acl_version[vers];
125#endif 124#endif
125 break;
126 case NFSD_CLEAR: 126 case NFSD_CLEAR:
127 nfsd_versions[vers] = NULL; 127 nfsd_versions[vers] = NULL;
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
129 if (vers < NFSD_ACL_NRVERS) 129 if (vers < NFSD_ACL_NRVERS)
130 nfsd_acl_version[vers] = NULL; 130 nfsd_acl_versions[vers] = NULL;
131#endif 131#endif
132 break; 132 break;
133 case NFSD_TEST: 133 case NFSD_TEST:
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index f5243f943996..6555c50d9006 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -462,9 +462,10 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
462} 462}
463 463
464int 464int
465nfssvc_encode_entry(struct readdir_cd *ccd, const char *name, 465nfssvc_encode_entry(void *ccdv, const char *name,
466 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 466 int namlen, loff_t offset, u64 ino, unsigned int d_type)
467{ 467{
468 struct readdir_cd *ccd = ccdv;
468 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); 469 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
469 __be32 *p = cd->buffer; 470 __be32 *p = cd->buffer;
470 int buflen, slen; 471 int buflen, slen;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7a79c23aa6d4..8283236c6a0f 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -59,7 +59,6 @@
59#include <asm/uaccess.h> 59#include <asm/uaccess.h>
60 60
61#define NFSDDBG_FACILITY NFSDDBG_FILEOP 61#define NFSDDBG_FACILITY NFSDDBG_FILEOP
62#define NFSD_PARANOIA
63 62
64 63
65/* We must ignore files (but only files) which might have mandatory 64/* We must ignore files (but only files) which might have mandatory
@@ -822,7 +821,8 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
822 rqstp->rq_res.page_len = size; 821 rqstp->rq_res.page_len = size;
823 } else if (page != pp[-1]) { 822 } else if (page != pp[-1]) {
824 get_page(page); 823 get_page(page);
825 put_page(*pp); 824 if (*pp)
825 put_page(*pp);
826 *pp = page; 826 *pp = page;
827 rqstp->rq_resused++; 827 rqstp->rq_resused++;
828 rqstp->rq_res.page_len += size; 828 rqstp->rq_res.page_len += size;
@@ -1244,7 +1244,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1244 __be32 err; 1244 __be32 err;
1245 int host_err; 1245 int host_err;
1246 __u32 v_mtime=0, v_atime=0; 1246 __u32 v_mtime=0, v_atime=0;
1247 int v_mode=0;
1248 1247
1249 err = nfserr_perm; 1248 err = nfserr_perm;
1250 if (!flen) 1249 if (!flen)
@@ -1281,16 +1280,11 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1281 goto out; 1280 goto out;
1282 1281
1283 if (createmode == NFS3_CREATE_EXCLUSIVE) { 1282 if (createmode == NFS3_CREATE_EXCLUSIVE) {
1284 /* while the verifier would fit in mtime+atime, 1283 /* solaris7 gets confused (bugid 4218508) if these have
1285 * solaris7 gets confused (bugid 4218508) if these have 1284 * the high bit set, so just clear the high bits.
1286 * the high bit set, so we use the mode as well
1287 */ 1285 */
1288 v_mtime = verifier[0]&0x7fffffff; 1286 v_mtime = verifier[0]&0x7fffffff;
1289 v_atime = verifier[1]&0x7fffffff; 1287 v_atime = verifier[1]&0x7fffffff;
1290 v_mode = S_IFREG
1291 | ((verifier[0]&0x80000000) >> (32-7)) /* u+x */
1292 | ((verifier[1]&0x80000000) >> (32-9)) /* u+r */
1293 ;
1294 } 1288 }
1295 1289
1296 if (dchild->d_inode) { 1290 if (dchild->d_inode) {
@@ -1318,7 +1312,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1318 case NFS3_CREATE_EXCLUSIVE: 1312 case NFS3_CREATE_EXCLUSIVE:
1319 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1313 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime
1320 && dchild->d_inode->i_atime.tv_sec == v_atime 1314 && dchild->d_inode->i_atime.tv_sec == v_atime
1321 && dchild->d_inode->i_mode == v_mode
1322 && dchild->d_inode->i_size == 0 ) 1315 && dchild->d_inode->i_size == 0 )
1323 break; 1316 break;
1324 /* fallthru */ 1317 /* fallthru */
@@ -1340,26 +1333,22 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1340 } 1333 }
1341 1334
1342 if (createmode == NFS3_CREATE_EXCLUSIVE) { 1335 if (createmode == NFS3_CREATE_EXCLUSIVE) {
1343 /* Cram the verifier into atime/mtime/mode */ 1336 /* Cram the verifier into atime/mtime */
1344 iap->ia_valid = ATTR_MTIME|ATTR_ATIME 1337 iap->ia_valid = ATTR_MTIME|ATTR_ATIME
1345 | ATTR_MTIME_SET|ATTR_ATIME_SET 1338 | ATTR_MTIME_SET|ATTR_ATIME_SET;
1346 | ATTR_MODE;
1347 /* XXX someone who knows this better please fix it for nsec */ 1339 /* XXX someone who knows this better please fix it for nsec */
1348 iap->ia_mtime.tv_sec = v_mtime; 1340 iap->ia_mtime.tv_sec = v_mtime;
1349 iap->ia_atime.tv_sec = v_atime; 1341 iap->ia_atime.tv_sec = v_atime;
1350 iap->ia_mtime.tv_nsec = 0; 1342 iap->ia_mtime.tv_nsec = 0;
1351 iap->ia_atime.tv_nsec = 0; 1343 iap->ia_atime.tv_nsec = 0;
1352 iap->ia_mode = v_mode;
1353 } 1344 }
1354 1345
1355 /* Set file attributes. 1346 /* Set file attributes.
1356 * Mode has already been set but we might need to reset it
1357 * for CREATE_EXCLUSIVE
1358 * Irix appears to send along the gid when it tries to 1347 * Irix appears to send along the gid when it tries to
1359 * implement setgid directories via NFS. Clear out all that cruft. 1348 * implement setgid directories via NFS. Clear out all that cruft.
1360 */ 1349 */
1361 set_attr: 1350 set_attr:
1362 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { 1351 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
1363 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1352 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1364 if (err2) 1353 if (err2)
1365 err = err2; 1354 err = err2;
@@ -1726,7 +1715,7 @@ out:
1726 */ 1715 */
1727__be32 1716__be32
1728nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 1717nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1729 struct readdir_cd *cdp, encode_dent_fn func) 1718 struct readdir_cd *cdp, filldir_t func)
1730{ 1719{
1731 __be32 err; 1720 __be32 err;
1732 int host_err; 1721 int host_err;
@@ -1751,7 +1740,7 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1751 1740
1752 do { 1741 do {
1753 cdp->err = nfserr_eof; /* will be cleared on successful read */ 1742 cdp->err = nfserr_eof; /* will be cleared on successful read */
1754 host_err = vfs_readdir(file, (filldir_t) func, cdp); 1743 host_err = vfs_readdir(file, func, cdp);
1755 } while (host_err >=0 && cdp->err == nfs_ok); 1744 } while (host_err >=0 && cdp->err == nfs_ok);
1756 if (host_err) 1745 if (host_err)
1757 err = nfserrno(host_err); 1746 err = nfserrno(host_err);