nfs3proc.c (f83d9396d1f63048c423efa00e4e244da10a35fd) | nfs3proc.c (7fe2a71dda349a1afa75781f0cc7975be9784d15) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Process version 3 NFS requests. 4 * 5 * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de> 6 */ 7 8#include <linux/fs.h> --- 53 unchanged lines hidden (view full) --- 62/* 63 * Set a file's attributes 64 */ 65static __be32 66nfsd3_proc_setattr(struct svc_rqst *rqstp) 67{ 68 struct nfsd3_sattrargs *argp = rqstp->rq_argp; 69 struct nfsd3_attrstat *resp = rqstp->rq_resp; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Process version 3 NFS requests. 4 * 5 * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de> 6 */ 7 8#include <linux/fs.h> --- 53 unchanged lines hidden (view full) --- 62/* 63 * Set a file's attributes 64 */ 65static __be32 66nfsd3_proc_setattr(struct svc_rqst *rqstp) 67{ 68 struct nfsd3_sattrargs *argp = rqstp->rq_argp; 69 struct nfsd3_attrstat *resp = rqstp->rq_resp; |
70 struct nfsd_attrs attrs = { 71 .na_iattr = &argp->attrs, 72 }; |
|
70 71 dprintk("nfsd: SETATTR(3) %s\n", 72 SVCFH_fmt(&argp->fh)); 73 74 fh_copy(&resp->fh, &argp->fh); | 73 74 dprintk("nfsd: SETATTR(3) %s\n", 75 SVCFH_fmt(&argp->fh)); 76 77 fh_copy(&resp->fh, &argp->fh); |
75 resp->status = nfsd_setattr(rqstp, &resp->fh, &argp->attrs, | 78 resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs, |
76 argp->check_guard, argp->guardtime); 77 return rpc_success; 78} 79 80/* 81 * Look up a path name component 82 */ 83static __be32 --- 144 unchanged lines hidden (view full) --- 228 * Upon return, caller must release @fhp and @resfhp. 229 */ 230static __be32 231nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, 232 struct svc_fh *resfhp, struct nfsd3_createargs *argp) 233{ 234 struct iattr *iap = &argp->attrs; 235 struct dentry *parent, *child; | 79 argp->check_guard, argp->guardtime); 80 return rpc_success; 81} 82 83/* 84 * Look up a path name component 85 */ 86static __be32 --- 144 unchanged lines hidden (view full) --- 231 * Upon return, caller must release @fhp and @resfhp. 232 */ 233static __be32 234nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, 235 struct svc_fh *resfhp, struct nfsd3_createargs *argp) 236{ 237 struct iattr *iap = &argp->attrs; 238 struct dentry *parent, *child; |
239 struct nfsd_attrs attrs = { 240 .na_iattr = iap, 241 }; |
|
236 __u32 v_mtime, v_atime; 237 struct inode *inode; 238 __be32 status; 239 int host_err; 240 241 if (isdotent(argp->name, argp->len)) 242 return nfserr_exist; 243 if (!(iap->ia_valid & ATTR_MODE)) --- 82 unchanged lines hidden (view full) --- 326 ATTR_MTIME_SET | ATTR_ATIME_SET; 327 iap->ia_mtime.tv_sec = v_mtime; 328 iap->ia_atime.tv_sec = v_atime; 329 iap->ia_mtime.tv_nsec = 0; 330 iap->ia_atime.tv_nsec = 0; 331 } 332 333set_attr: | 242 __u32 v_mtime, v_atime; 243 struct inode *inode; 244 __be32 status; 245 int host_err; 246 247 if (isdotent(argp->name, argp->len)) 248 return nfserr_exist; 249 if (!(iap->ia_valid & ATTR_MODE)) --- 82 unchanged lines hidden (view full) --- 332 ATTR_MTIME_SET | ATTR_ATIME_SET; 333 iap->ia_mtime.tv_sec = v_mtime; 334 iap->ia_atime.tv_sec = v_atime; 335 iap->ia_mtime.tv_nsec = 0; 336 iap->ia_atime.tv_nsec = 0; 337 } 338 339set_attr: |
334 status = nfsd_create_setattr(rqstp, fhp, resfhp, iap); | 340 status = nfsd_create_setattr(rqstp, fhp, resfhp, &attrs); |
335 336out: 337 fh_unlock(fhp); 338 if (child && !IS_ERR(child)) 339 dput(child); 340 fh_drop_write(fhp); 341 return status; 342} --- 20 unchanged lines hidden (view full) --- 363/* 364 * Make directory. This operation is not idempotent. 365 */ 366static __be32 367nfsd3_proc_mkdir(struct svc_rqst *rqstp) 368{ 369 struct nfsd3_createargs *argp = rqstp->rq_argp; 370 struct nfsd3_diropres *resp = rqstp->rq_resp; | 341 342out: 343 fh_unlock(fhp); 344 if (child && !IS_ERR(child)) 345 dput(child); 346 fh_drop_write(fhp); 347 return status; 348} --- 20 unchanged lines hidden (view full) --- 369/* 370 * Make directory. This operation is not idempotent. 371 */ 372static __be32 373nfsd3_proc_mkdir(struct svc_rqst *rqstp) 374{ 375 struct nfsd3_createargs *argp = rqstp->rq_argp; 376 struct nfsd3_diropres *resp = rqstp->rq_resp; |
377 struct nfsd_attrs attrs = { 378 .na_iattr = &argp->attrs, 379 }; |
|
371 372 dprintk("nfsd: MKDIR(3) %s %.*s\n", 373 SVCFH_fmt(&argp->fh), 374 argp->len, 375 argp->name); 376 377 argp->attrs.ia_valid &= ~ATTR_SIZE; 378 fh_copy(&resp->dirfh, &argp->fh); 379 fh_init(&resp->fh, NFS3_FHSIZE); 380 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, | 380 381 dprintk("nfsd: MKDIR(3) %s %.*s\n", 382 SVCFH_fmt(&argp->fh), 383 argp->len, 384 argp->name); 385 386 argp->attrs.ia_valid &= ~ATTR_SIZE; 387 fh_copy(&resp->dirfh, &argp->fh); 388 fh_init(&resp->fh, NFS3_FHSIZE); 389 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
381 &argp->attrs, S_IFDIR, 0, &resp->fh); | 390 &attrs, S_IFDIR, 0, &resp->fh); |
382 fh_unlock(&resp->dirfh); 383 return rpc_success; 384} 385 386static __be32 387nfsd3_proc_symlink(struct svc_rqst *rqstp) 388{ 389 struct nfsd3_symlinkargs *argp = rqstp->rq_argp; --- 33 unchanged lines hidden (view full) --- 423/* 424 * Make socket/fifo/device. 425 */ 426static __be32 427nfsd3_proc_mknod(struct svc_rqst *rqstp) 428{ 429 struct nfsd3_mknodargs *argp = rqstp->rq_argp; 430 struct nfsd3_diropres *resp = rqstp->rq_resp; | 391 fh_unlock(&resp->dirfh); 392 return rpc_success; 393} 394 395static __be32 396nfsd3_proc_symlink(struct svc_rqst *rqstp) 397{ 398 struct nfsd3_symlinkargs *argp = rqstp->rq_argp; --- 33 unchanged lines hidden (view full) --- 432/* 433 * Make socket/fifo/device. 434 */ 435static __be32 436nfsd3_proc_mknod(struct svc_rqst *rqstp) 437{ 438 struct nfsd3_mknodargs *argp = rqstp->rq_argp; 439 struct nfsd3_diropres *resp = rqstp->rq_resp; |
440 struct nfsd_attrs attrs = { 441 .na_iattr = &argp->attrs, 442 }; |
|
431 int type; 432 dev_t rdev = 0; 433 434 dprintk("nfsd: MKNOD(3) %s %.*s\n", 435 SVCFH_fmt(&argp->fh), 436 argp->len, 437 argp->name); 438 --- 9 unchanged lines hidden (view full) --- 448 } 449 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) { 450 resp->status = nfserr_badtype; 451 goto out; 452 } 453 454 type = nfs3_ftypes[argp->ftype]; 455 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, | 443 int type; 444 dev_t rdev = 0; 445 446 dprintk("nfsd: MKNOD(3) %s %.*s\n", 447 SVCFH_fmt(&argp->fh), 448 argp->len, 449 argp->name); 450 --- 9 unchanged lines hidden (view full) --- 460 } 461 } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) { 462 resp->status = nfserr_badtype; 463 goto out; 464 } 465 466 type = nfs3_ftypes[argp->ftype]; 467 resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
456 &argp->attrs, type, rdev, &resp->fh); | 468 &attrs, type, rdev, &resp->fh); |
457 fh_unlock(&resp->dirfh); 458out: 459 return rpc_success; 460} 461 462/* 463 * Remove file/fifo/socket etc. 464 */ --- 575 unchanged lines hidden --- | 469 fh_unlock(&resp->dirfh); 470out: 471 return rpc_success; 472} 473 474/* 475 * Remove file/fifo/socket etc. 476 */ --- 575 unchanged lines hidden --- |