diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:10:27 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:10:27 -0400 |
commit | 409924e4c943072a63c43bb6b77576bf12f1896b (patch) | |
tree | cf598400a995a61c1566db9b1e552a39d5a1dc53 /fs/nfs/nfs4xdr.c | |
parent | f26c7a78876ccd6c9b477ab4ca127aa1a4ef68c7 (diff) |
NFSv4: Make decode_getfattr() set fattr->valid to reflect what was decoded
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 92 |
1 files changed, 73 insertions, 19 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 43c6e50ff173..1690f0e44b91 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -2157,6 +2157,7 @@ static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint3 | |||
2157 | static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) | 2157 | static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) |
2158 | { | 2158 | { |
2159 | __be32 *p; | 2159 | __be32 *p; |
2160 | int ret = 0; | ||
2160 | 2161 | ||
2161 | *type = 0; | 2162 | *type = 0; |
2162 | if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) | 2163 | if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) |
@@ -2169,14 +2170,16 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2169 | return -EIO; | 2170 | return -EIO; |
2170 | } | 2171 | } |
2171 | bitmap[0] &= ~FATTR4_WORD0_TYPE; | 2172 | bitmap[0] &= ~FATTR4_WORD0_TYPE; |
2173 | ret = NFS_ATTR_FATTR_TYPE; | ||
2172 | } | 2174 | } |
2173 | dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type]); | 2175 | dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type]); |
2174 | return 0; | 2176 | return ret; |
2175 | } | 2177 | } |
2176 | 2178 | ||
2177 | static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) | 2179 | static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) |
2178 | { | 2180 | { |
2179 | __be32 *p; | 2181 | __be32 *p; |
2182 | int ret = 0; | ||
2180 | 2183 | ||
2181 | *change = 0; | 2184 | *change = 0; |
2182 | if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) | 2185 | if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) |
@@ -2185,15 +2188,17 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2185 | READ_BUF(8); | 2188 | READ_BUF(8); |
2186 | READ64(*change); | 2189 | READ64(*change); |
2187 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; | 2190 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; |
2191 | ret = NFS_ATTR_FATTR_CHANGE; | ||
2188 | } | 2192 | } |
2189 | dprintk("%s: change attribute=%Lu\n", __func__, | 2193 | dprintk("%s: change attribute=%Lu\n", __func__, |
2190 | (unsigned long long)*change); | 2194 | (unsigned long long)*change); |
2191 | return 0; | 2195 | return ret; |
2192 | } | 2196 | } |
2193 | 2197 | ||
2194 | static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) | 2198 | static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) |
2195 | { | 2199 | { |
2196 | __be32 *p; | 2200 | __be32 *p; |
2201 | int ret = 0; | ||
2197 | 2202 | ||
2198 | *size = 0; | 2203 | *size = 0; |
2199 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) | 2204 | if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) |
@@ -2202,9 +2207,10 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t * | |||
2202 | READ_BUF(8); | 2207 | READ_BUF(8); |
2203 | READ64(*size); | 2208 | READ64(*size); |
2204 | bitmap[0] &= ~FATTR4_WORD0_SIZE; | 2209 | bitmap[0] &= ~FATTR4_WORD0_SIZE; |
2210 | ret = NFS_ATTR_FATTR_SIZE; | ||
2205 | } | 2211 | } |
2206 | dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size); | 2212 | dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size); |
2207 | return 0; | 2213 | return ret; |
2208 | } | 2214 | } |
2209 | 2215 | ||
2210 | static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2216 | static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
@@ -2242,6 +2248,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, | |||
2242 | static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) | 2248 | static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) |
2243 | { | 2249 | { |
2244 | __be32 *p; | 2250 | __be32 *p; |
2251 | int ret = 0; | ||
2245 | 2252 | ||
2246 | fsid->major = 0; | 2253 | fsid->major = 0; |
2247 | fsid->minor = 0; | 2254 | fsid->minor = 0; |
@@ -2252,11 +2259,12 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs | |||
2252 | READ64(fsid->major); | 2259 | READ64(fsid->major); |
2253 | READ64(fsid->minor); | 2260 | READ64(fsid->minor); |
2254 | bitmap[0] &= ~FATTR4_WORD0_FSID; | 2261 | bitmap[0] &= ~FATTR4_WORD0_FSID; |
2262 | ret = NFS_ATTR_FATTR_FSID; | ||
2255 | } | 2263 | } |
2256 | dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __func__, | 2264 | dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __func__, |
2257 | (unsigned long long)fsid->major, | 2265 | (unsigned long long)fsid->major, |
2258 | (unsigned long long)fsid->minor); | 2266 | (unsigned long long)fsid->minor); |
2259 | return 0; | 2267 | return ret; |
2260 | } | 2268 | } |
2261 | 2269 | ||
2262 | static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) | 2270 | static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) |
@@ -2294,6 +2302,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2294 | static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) | 2302 | static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) |
2295 | { | 2303 | { |
2296 | __be32 *p; | 2304 | __be32 *p; |
2305 | int ret = 0; | ||
2297 | 2306 | ||
2298 | *fileid = 0; | 2307 | *fileid = 0; |
2299 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) | 2308 | if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) |
@@ -2302,14 +2311,16 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2302 | READ_BUF(8); | 2311 | READ_BUF(8); |
2303 | READ64(*fileid); | 2312 | READ64(*fileid); |
2304 | bitmap[0] &= ~FATTR4_WORD0_FILEID; | 2313 | bitmap[0] &= ~FATTR4_WORD0_FILEID; |
2314 | ret = NFS_ATTR_FATTR_FILEID; | ||
2305 | } | 2315 | } |
2306 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); | 2316 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); |
2307 | return 0; | 2317 | return ret; |
2308 | } | 2318 | } |
2309 | 2319 | ||
2310 | static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) | 2320 | static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) |
2311 | { | 2321 | { |
2312 | __be32 *p; | 2322 | __be32 *p; |
2323 | int ret = 0; | ||
2313 | 2324 | ||
2314 | *fileid = 0; | 2325 | *fileid = 0; |
2315 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) | 2326 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) |
@@ -2318,9 +2329,10 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
2318 | READ_BUF(8); | 2329 | READ_BUF(8); |
2319 | READ64(*fileid); | 2330 | READ64(*fileid); |
2320 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 2331 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
2332 | ret = NFS_ATTR_FATTR_FILEID; | ||
2321 | } | 2333 | } |
2322 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); | 2334 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); |
2323 | return 0; | 2335 | return ret; |
2324 | } | 2336 | } |
2325 | 2337 | ||
2326 | static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2338 | static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
@@ -2476,6 +2488,8 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2476 | if (res->nlocations < NFS4_FS_LOCATIONS_MAXENTRIES) | 2488 | if (res->nlocations < NFS4_FS_LOCATIONS_MAXENTRIES) |
2477 | res->nlocations++; | 2489 | res->nlocations++; |
2478 | } | 2490 | } |
2491 | if (res->nlocations != 0) | ||
2492 | status = NFS_ATTR_FATTR_V4_REFERRAL; | ||
2479 | out: | 2493 | out: |
2480 | dprintk("%s: fs_locations done, error = %d\n", __func__, status); | 2494 | dprintk("%s: fs_locations done, error = %d\n", __func__, status); |
2481 | return status; | 2495 | return status; |
@@ -2581,6 +2595,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m | |||
2581 | { | 2595 | { |
2582 | uint32_t tmp; | 2596 | uint32_t tmp; |
2583 | __be32 *p; | 2597 | __be32 *p; |
2598 | int ret = 0; | ||
2584 | 2599 | ||
2585 | *mode = 0; | 2600 | *mode = 0; |
2586 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) | 2601 | if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) |
@@ -2590,14 +2605,16 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m | |||
2590 | READ32(tmp); | 2605 | READ32(tmp); |
2591 | *mode = tmp & ~S_IFMT; | 2606 | *mode = tmp & ~S_IFMT; |
2592 | bitmap[1] &= ~FATTR4_WORD1_MODE; | 2607 | bitmap[1] &= ~FATTR4_WORD1_MODE; |
2608 | ret = NFS_ATTR_FATTR_MODE; | ||
2593 | } | 2609 | } |
2594 | dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); | 2610 | dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); |
2595 | return 0; | 2611 | return ret; |
2596 | } | 2612 | } |
2597 | 2613 | ||
2598 | static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) | 2614 | static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) |
2599 | { | 2615 | { |
2600 | __be32 *p; | 2616 | __be32 *p; |
2617 | int ret = 0; | ||
2601 | 2618 | ||
2602 | *nlink = 1; | 2619 | *nlink = 1; |
2603 | if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) | 2620 | if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) |
@@ -2606,15 +2623,17 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t | |||
2606 | READ_BUF(4); | 2623 | READ_BUF(4); |
2607 | READ32(*nlink); | 2624 | READ32(*nlink); |
2608 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; | 2625 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; |
2626 | ret = NFS_ATTR_FATTR_NLINK; | ||
2609 | } | 2627 | } |
2610 | dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink); | 2628 | dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink); |
2611 | return 0; | 2629 | return ret; |
2612 | } | 2630 | } |
2613 | 2631 | ||
2614 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *uid) | 2632 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *uid) |
2615 | { | 2633 | { |
2616 | uint32_t len; | 2634 | uint32_t len; |
2617 | __be32 *p; | 2635 | __be32 *p; |
2636 | int ret = 0; | ||
2618 | 2637 | ||
2619 | *uid = -2; | 2638 | *uid = -2; |
2620 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) | 2639 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) |
@@ -2624,7 +2643,9 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2624 | READ32(len); | 2643 | READ32(len); |
2625 | READ_BUF(len); | 2644 | READ_BUF(len); |
2626 | if (len < XDR_MAX_NETOBJ) { | 2645 | if (len < XDR_MAX_NETOBJ) { |
2627 | if (nfs_map_name_to_uid(clp, (char *)p, len, uid) != 0) | 2646 | if (nfs_map_name_to_uid(clp, (char *)p, len, uid) == 0) |
2647 | ret = NFS_ATTR_FATTR_OWNER; | ||
2648 | else | ||
2628 | dprintk("%s: nfs_map_name_to_uid failed!\n", | 2649 | dprintk("%s: nfs_map_name_to_uid failed!\n", |
2629 | __func__); | 2650 | __func__); |
2630 | } else | 2651 | } else |
@@ -2633,13 +2654,14 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2633 | bitmap[1] &= ~FATTR4_WORD1_OWNER; | 2654 | bitmap[1] &= ~FATTR4_WORD1_OWNER; |
2634 | } | 2655 | } |
2635 | dprintk("%s: uid=%d\n", __func__, (int)*uid); | 2656 | dprintk("%s: uid=%d\n", __func__, (int)*uid); |
2636 | return 0; | 2657 | return ret; |
2637 | } | 2658 | } |
2638 | 2659 | ||
2639 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *gid) | 2660 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *gid) |
2640 | { | 2661 | { |
2641 | uint32_t len; | 2662 | uint32_t len; |
2642 | __be32 *p; | 2663 | __be32 *p; |
2664 | int ret = 0; | ||
2643 | 2665 | ||
2644 | *gid = -2; | 2666 | *gid = -2; |
2645 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) | 2667 | if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) |
@@ -2649,7 +2671,9 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2649 | READ32(len); | 2671 | READ32(len); |
2650 | READ_BUF(len); | 2672 | READ_BUF(len); |
2651 | if (len < XDR_MAX_NETOBJ) { | 2673 | if (len < XDR_MAX_NETOBJ) { |
2652 | if (nfs_map_group_to_gid(clp, (char *)p, len, gid) != 0) | 2674 | if (nfs_map_group_to_gid(clp, (char *)p, len, gid) == 0) |
2675 | ret = NFS_ATTR_FATTR_GROUP; | ||
2676 | else | ||
2653 | dprintk("%s: nfs_map_group_to_gid failed!\n", | 2677 | dprintk("%s: nfs_map_group_to_gid failed!\n", |
2654 | __func__); | 2678 | __func__); |
2655 | } else | 2679 | } else |
@@ -2658,13 +2682,14 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2658 | bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; | 2682 | bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; |
2659 | } | 2683 | } |
2660 | dprintk("%s: gid=%d\n", __func__, (int)*gid); | 2684 | dprintk("%s: gid=%d\n", __func__, (int)*gid); |
2661 | return 0; | 2685 | return ret; |
2662 | } | 2686 | } |
2663 | 2687 | ||
2664 | static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) | 2688 | static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) |
2665 | { | 2689 | { |
2666 | uint32_t major = 0, minor = 0; | 2690 | uint32_t major = 0, minor = 0; |
2667 | __be32 *p; | 2691 | __be32 *p; |
2692 | int ret = 0; | ||
2668 | 2693 | ||
2669 | *rdev = MKDEV(0,0); | 2694 | *rdev = MKDEV(0,0); |
2670 | if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) | 2695 | if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) |
@@ -2679,9 +2704,10 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde | |||
2679 | if (MAJOR(tmp) == major && MINOR(tmp) == minor) | 2704 | if (MAJOR(tmp) == major && MINOR(tmp) == minor) |
2680 | *rdev = tmp; | 2705 | *rdev = tmp; |
2681 | bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; | 2706 | bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; |
2707 | ret = NFS_ATTR_FATTR_RDEV; | ||
2682 | } | 2708 | } |
2683 | dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor); | 2709 | dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor); |
2684 | return 0; | 2710 | return ret; |
2685 | } | 2711 | } |
2686 | 2712 | ||
2687 | static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) | 2713 | static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) |
@@ -2738,6 +2764,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2738 | static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) | 2764 | static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) |
2739 | { | 2765 | { |
2740 | __be32 *p; | 2766 | __be32 *p; |
2767 | int ret = 0; | ||
2741 | 2768 | ||
2742 | *used = 0; | 2769 | *used = 0; |
2743 | if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) | 2770 | if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) |
@@ -2746,10 +2773,11 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2746 | READ_BUF(8); | 2773 | READ_BUF(8); |
2747 | READ64(*used); | 2774 | READ64(*used); |
2748 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; | 2775 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; |
2776 | ret = NFS_ATTR_FATTR_SPACE_USED; | ||
2749 | } | 2777 | } |
2750 | dprintk("%s: space used=%Lu\n", __func__, | 2778 | dprintk("%s: space used=%Lu\n", __func__, |
2751 | (unsigned long long)*used); | 2779 | (unsigned long long)*used); |
2752 | return 0; | 2780 | return ret; |
2753 | } | 2781 | } |
2754 | 2782 | ||
2755 | static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) | 2783 | static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) |
@@ -2776,6 +2804,8 @@ static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, str | |||
2776 | return -EIO; | 2804 | return -EIO; |
2777 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_ACCESS)) { | 2805 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_ACCESS)) { |
2778 | status = decode_attr_time(xdr, time); | 2806 | status = decode_attr_time(xdr, time); |
2807 | if (status == 0) | ||
2808 | status = NFS_ATTR_FATTR_ATIME; | ||
2779 | bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; | 2809 | bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; |
2780 | } | 2810 | } |
2781 | dprintk("%s: atime=%ld\n", __func__, (long)time->tv_sec); | 2811 | dprintk("%s: atime=%ld\n", __func__, (long)time->tv_sec); |
@@ -2792,6 +2822,8 @@ static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, s | |||
2792 | return -EIO; | 2822 | return -EIO; |
2793 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) { | 2823 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) { |
2794 | status = decode_attr_time(xdr, time); | 2824 | status = decode_attr_time(xdr, time); |
2825 | if (status == 0) | ||
2826 | status = NFS_ATTR_FATTR_CTIME; | ||
2795 | bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; | 2827 | bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; |
2796 | } | 2828 | } |
2797 | dprintk("%s: ctime=%ld\n", __func__, (long)time->tv_sec); | 2829 | dprintk("%s: ctime=%ld\n", __func__, (long)time->tv_sec); |
@@ -2808,6 +2840,8 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str | |||
2808 | return -EIO; | 2840 | return -EIO; |
2809 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) { | 2841 | if (likely(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) { |
2810 | status = decode_attr_time(xdr, time); | 2842 | status = decode_attr_time(xdr, time); |
2843 | if (status == 0) | ||
2844 | status = NFS_ATTR_FATTR_MTIME; | ||
2811 | bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; | 2845 | bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; |
2812 | } | 2846 | } |
2813 | dprintk("%s: mtime=%ld\n", __func__, (long)time->tv_sec); | 2847 | dprintk("%s: mtime=%ld\n", __func__, (long)time->tv_sec); |
@@ -3012,76 +3046,96 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons | |||
3012 | status = decode_attr_type(xdr, bitmap, &type); | 3046 | status = decode_attr_type(xdr, bitmap, &type); |
3013 | if (status < 0) | 3047 | if (status < 0) |
3014 | goto xdr_error; | 3048 | goto xdr_error; |
3015 | fattr->mode = nfs_type2fmt[type]; | 3049 | fattr->mode = 0; |
3050 | if (status != 0) { | ||
3051 | fattr->mode |= nfs_type2fmt[type]; | ||
3052 | fattr->valid |= status; | ||
3053 | } | ||
3016 | 3054 | ||
3017 | status = decode_attr_change(xdr, bitmap, &fattr->change_attr); | 3055 | status = decode_attr_change(xdr, bitmap, &fattr->change_attr); |
3018 | if (status < 0) | 3056 | if (status < 0) |
3019 | goto xdr_error; | 3057 | goto xdr_error; |
3058 | fattr->valid |= status; | ||
3020 | 3059 | ||
3021 | status = decode_attr_size(xdr, bitmap, &fattr->size); | 3060 | status = decode_attr_size(xdr, bitmap, &fattr->size); |
3022 | if (status < 0) | 3061 | if (status < 0) |
3023 | goto xdr_error; | 3062 | goto xdr_error; |
3063 | fattr->valid |= status; | ||
3024 | 3064 | ||
3025 | status = decode_attr_fsid(xdr, bitmap, &fattr->fsid); | 3065 | status = decode_attr_fsid(xdr, bitmap, &fattr->fsid); |
3026 | if (status < 0) | 3066 | if (status < 0) |
3027 | goto xdr_error; | 3067 | goto xdr_error; |
3068 | fattr->valid |= status; | ||
3028 | 3069 | ||
3029 | status = decode_attr_fileid(xdr, bitmap, &fattr->fileid); | 3070 | status = decode_attr_fileid(xdr, bitmap, &fattr->fileid); |
3030 | if (status < 0) | 3071 | if (status < 0) |
3031 | goto xdr_error; | 3072 | goto xdr_error; |
3073 | fattr->valid |= status; | ||
3032 | 3074 | ||
3033 | status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr, | 3075 | status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr, |
3034 | struct nfs4_fs_locations, | 3076 | struct nfs4_fs_locations, |
3035 | fattr)); | 3077 | fattr)); |
3036 | if (status < 0) | 3078 | if (status < 0) |
3037 | goto xdr_error; | 3079 | goto xdr_error; |
3080 | fattr->valid |= status; | ||
3038 | 3081 | ||
3039 | status = decode_attr_mode(xdr, bitmap, &fmode); | 3082 | status = decode_attr_mode(xdr, bitmap, &fmode); |
3040 | if (status < 0) | 3083 | if (status < 0) |
3041 | goto xdr_error; | 3084 | goto xdr_error; |
3042 | fattr->mode |= fmode; | 3085 | if (status != 0) { |
3086 | fattr->mode |= fmode; | ||
3087 | fattr->valid |= status; | ||
3088 | } | ||
3043 | 3089 | ||
3044 | status = decode_attr_nlink(xdr, bitmap, &fattr->nlink); | 3090 | status = decode_attr_nlink(xdr, bitmap, &fattr->nlink); |
3045 | if (status < 0) | 3091 | if (status < 0) |
3046 | goto xdr_error; | 3092 | goto xdr_error; |
3093 | fattr->valid |= status; | ||
3047 | 3094 | ||
3048 | status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid); | 3095 | status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid); |
3049 | if (status < 0) | 3096 | if (status < 0) |
3050 | goto xdr_error; | 3097 | goto xdr_error; |
3098 | fattr->valid |= status; | ||
3051 | 3099 | ||
3052 | status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid); | 3100 | status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid); |
3053 | if (status < 0) | 3101 | if (status < 0) |
3054 | goto xdr_error; | 3102 | goto xdr_error; |
3103 | fattr->valid |= status; | ||
3055 | 3104 | ||
3056 | status = decode_attr_rdev(xdr, bitmap, &fattr->rdev); | 3105 | status = decode_attr_rdev(xdr, bitmap, &fattr->rdev); |
3057 | if (status < 0) | 3106 | if (status < 0) |
3058 | goto xdr_error; | 3107 | goto xdr_error; |
3108 | fattr->valid |= status; | ||
3059 | 3109 | ||
3060 | status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used); | 3110 | status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used); |
3061 | if (status < 0) | 3111 | if (status < 0) |
3062 | goto xdr_error; | 3112 | goto xdr_error; |
3113 | fattr->valid |= status; | ||
3063 | 3114 | ||
3064 | status = decode_attr_time_access(xdr, bitmap, &fattr->atime); | 3115 | status = decode_attr_time_access(xdr, bitmap, &fattr->atime); |
3065 | if (status < 0) | 3116 | if (status < 0) |
3066 | goto xdr_error; | 3117 | goto xdr_error; |
3118 | fattr->valid |= status; | ||
3067 | 3119 | ||
3068 | status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime); | 3120 | status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime); |
3069 | if (status < 0) | 3121 | if (status < 0) |
3070 | goto xdr_error; | 3122 | goto xdr_error; |
3123 | fattr->valid |= status; | ||
3071 | 3124 | ||
3072 | status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime); | 3125 | status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime); |
3073 | if (status < 0) | 3126 | if (status < 0) |
3074 | goto xdr_error; | 3127 | goto xdr_error; |
3128 | fattr->valid |= status; | ||
3075 | 3129 | ||
3076 | status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid); | 3130 | status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid); |
3077 | if (status < 0) | 3131 | if (status < 0) |
3078 | goto xdr_error; | 3132 | goto xdr_error; |
3079 | if (fattr->fileid == 0 && fileid != 0) | 3133 | if (status != 0 && !(fattr->valid & status)) { |
3080 | fattr->fileid = fileid; | 3134 | fattr->fileid = fileid; |
3135 | fattr->valid |= status; | ||
3136 | } | ||
3081 | 3137 | ||
3082 | status = verify_attr_len(xdr, savep, attrlen); | 3138 | status = verify_attr_len(xdr, savep, attrlen); |
3083 | if (status == 0) | ||
3084 | fattr->valid = NFS_ATTR_FATTR_V4; | ||
3085 | xdr_error: | 3139 | xdr_error: |
3086 | dprintk("%s: xdr returned %d\n", __func__, -status); | 3140 | dprintk("%s: xdr returned %d\n", __func__, -status); |
3087 | return status; | 3141 | return status; |