[PATCH] kNFSd: NFSv4: tweak nfsd_create_v3() for NFSv4
File creation in NFSv4 is almost the same as in NFSv3, with one minor difference. If an UNCHECKED create is done, and the file exists, we don't set any attributes. Exception: If size==0 is specified as part of the attributes, then we do truncate the file, but only after processing the rest of the OPEN. (File creation is always part of an OPEN request.) This patch defines a new argument *truncp to nfsd_create_v3(), which will be NULL for v3 requests. For v4 requests, it will point to a variable which should be set to 1 if file truncation is still needed. The logic in nfsd_create_v3() is changed as follows: If - *truncp is not NULL - the create is UNCHECKED - the file exists then nfsd_create_v3() returns immediately. If size==0 is specified, then *truncp is set to 1. This is kind of a hack, but the only alternative I could see was creating a new routine nfsd_create_v4(), which would be identical to nfsd_create_v3() except for this point.
Showing
Please register or sign in to comment