diff options
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 29 |
1 files changed, 9 insertions, 20 deletions
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 |
1728 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | 1717 | nfsd_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); |