nfs3xdr.c (942b20dc245590327ee0187c15c78174cd96dd52) nfs3xdr.c (daab110e47f8d7aa6da66923e3ac1a8dbd2b2a72)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * XDR support for nfsd/protocol version 3.
4 *
5 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
6 *
7 * 2003-08-09 Jamie Lokier: Use htonl() for nanoseconds, not htons()!
8 */

--- 192 unchanged lines hidden (view full) ---

201 * Encode post-operation attributes.
202 * The inode may be NULL if the call failed because of a stale file
203 * handle. In this case, no attributes are returned.
204 */
205static __be32 *
206encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
207{
208 struct dentry *dentry = fhp->fh_dentry;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * XDR support for nfsd/protocol version 3.
4 *
5 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
6 *
7 * 2003-08-09 Jamie Lokier: Use htonl() for nanoseconds, not htons()!
8 */

--- 192 unchanged lines hidden (view full) ---

201 * Encode post-operation attributes.
202 * The inode may be NULL if the call failed because of a stale file
203 * handle. In this case, no attributes are returned.
204 */
205static __be32 *
206encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
207{
208 struct dentry *dentry = fhp->fh_dentry;
209 if (dentry && d_really_is_positive(dentry)) {
209 if (!fhp->fh_no_wcc && dentry && d_really_is_positive(dentry)) {
210 __be32 err;
211 struct kstat stat;
212
213 err = fh_getattr(fhp, &stat);
214 if (!err) {
215 *p++ = xdr_one; /* attributes follow */
216 lease_get_mtime(d_inode(dentry), &stat.mtime);
217 return encode_fattr3(rqstp, p, fhp, &stat);

--- 39 unchanged lines hidden (view full) ---

257 */
258void fill_pre_wcc(struct svc_fh *fhp)
259{
260 struct inode *inode;
261 struct kstat stat;
262 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
263 __be32 err;
264
210 __be32 err;
211 struct kstat stat;
212
213 err = fh_getattr(fhp, &stat);
214 if (!err) {
215 *p++ = xdr_one; /* attributes follow */
216 lease_get_mtime(d_inode(dentry), &stat.mtime);
217 return encode_fattr3(rqstp, p, fhp, &stat);

--- 39 unchanged lines hidden (view full) ---

257 */
258void fill_pre_wcc(struct svc_fh *fhp)
259{
260 struct inode *inode;
261 struct kstat stat;
262 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
263 __be32 err;
264
265 if (fhp->fh_pre_saved)
265 if (fhp->fh_no_wcc || fhp->fh_pre_saved)
266 return;
267 inode = d_inode(fhp->fh_dentry);
268 err = fh_getattr(fhp, &stat);
269 if (err) {
270 /* Grab the times from inode anyway */
271 stat.mtime = inode->i_mtime;
272 stat.ctime = inode->i_ctime;
273 stat.size = inode->i_size;

--- 11 unchanged lines hidden (view full) ---

285 * Fill in the post_op attr for the wcc data
286 */
287void fill_post_wcc(struct svc_fh *fhp)
288{
289 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
290 struct inode *inode = d_inode(fhp->fh_dentry);
291 __be32 err;
292
266 return;
267 inode = d_inode(fhp->fh_dentry);
268 err = fh_getattr(fhp, &stat);
269 if (err) {
270 /* Grab the times from inode anyway */
271 stat.mtime = inode->i_mtime;
272 stat.ctime = inode->i_ctime;
273 stat.size = inode->i_size;

--- 11 unchanged lines hidden (view full) ---

285 * Fill in the post_op attr for the wcc data
286 */
287void fill_post_wcc(struct svc_fh *fhp)
288{
289 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
290 struct inode *inode = d_inode(fhp->fh_dentry);
291 __be32 err;
292
293 if (fhp->fh_no_wcc)
294 return;
295
293 if (fhp->fh_post_saved)
294 printk("nfsd: inode locked twice during operation.\n");
295
296 err = fh_getattr(fhp, &fhp->fh_post_attr);
297 if (err) {
298 fhp->fh_post_saved = false;
299 fhp->fh_post_attr.ctime = inode->i_ctime;
300 } else

--- 865 unchanged lines hidden ---
296 if (fhp->fh_post_saved)
297 printk("nfsd: inode locked twice during operation.\n");
298
299 err = fh_getattr(fhp, &fhp->fh_post_attr);
300 if (err) {
301 fhp->fh_post_saved = false;
302 fhp->fh_post_attr.ctime = inode->i_ctime;
303 } else

--- 865 unchanged lines hidden ---