Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nfsd-4.10-2' of git://linux-nfs.org/~bfields/linux

Pull nfsd fixes from Bruce Fields:
"Three more miscellaneous nfsd bugfixes"

* tag 'nfsd-4.10-2' of git://linux-nfs.org/~bfields/linux:
svcrpc: fix oops in absence of krb5 module
nfsd: special case truncates some more
NFSD: Fix a null reference case in find_or_create_lock_stateid()

+51 -76
+3 -2
fs/nfsd/nfs4layouts.c
··· 223 223 struct nfs4_layout_stateid *ls; 224 224 struct nfs4_stid *stp; 225 225 226 - stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache); 226 + stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache, 227 + nfsd4_free_layout_stateid); 227 228 if (!stp) 228 229 return NULL; 229 - stp->sc_free = nfsd4_free_layout_stateid; 230 + 230 231 get_nfs4_file(fp); 231 232 stp->sc_file = fp; 232 233
+8 -11
fs/nfsd/nfs4state.c
··· 633 633 return co; 634 634 } 635 635 636 - struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, 637 - struct kmem_cache *slab) 636 + struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, 637 + void (*sc_free)(struct nfs4_stid *)) 638 638 { 639 639 struct nfs4_stid *stid; 640 640 int new_id; ··· 650 650 idr_preload_end(); 651 651 if (new_id < 0) 652 652 goto out_free; 653 + 654 + stid->sc_free = sc_free; 653 655 stid->sc_client = cl; 654 656 stid->sc_stateid.si_opaque.so_id = new_id; 655 657 stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; ··· 677 675 static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) 678 676 { 679 677 struct nfs4_stid *stid; 680 - struct nfs4_ol_stateid *stp; 681 678 682 - stid = nfs4_alloc_stid(clp, stateid_slab); 679 + stid = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_ol_stateid); 683 680 if (!stid) 684 681 return NULL; 685 682 686 - stp = openlockstateid(stid); 687 - stp->st_stid.sc_free = nfs4_free_ol_stateid; 688 - return stp; 683 + return openlockstateid(stid); 689 684 } 690 685 691 686 static void nfs4_free_deleg(struct nfs4_stid *stid) ··· 780 781 goto out_dec; 781 782 if (delegation_blocked(&current_fh->fh_handle)) 782 783 goto out_dec; 783 - dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); 784 + dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab, nfs4_free_deleg)); 784 785 if (dp == NULL) 785 786 goto out_dec; 786 787 787 - dp->dl_stid.sc_free = nfs4_free_deleg; 788 788 /* 789 789 * delegation seqid's are never incremented. The 4.1 special 790 790 * meaning of seqid 0 isn't meaningful, really, but let's avoid ··· 5578 5580 stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); 5579 5581 get_nfs4_file(fp); 5580 5582 stp->st_stid.sc_file = fp; 5581 - stp->st_stid.sc_free = nfs4_free_lock_stateid; 5582 5583 stp->st_access_bmap = 0; 5583 5584 stp->st_deny_bmap = open_stp->st_deny_bmap; 5584 5585 stp->st_openstp = open_stp; ··· 5620 5623 lst = find_lock_stateid(lo, fi); 5621 5624 if (lst == NULL) { 5622 5625 spin_unlock(&clp->cl_lock); 5623 - ns = nfs4_alloc_stid(clp, stateid_slab); 5626 + ns = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_lock_stateid); 5624 5627 if (ns == NULL) 5625 5628 return NULL; 5626 5629
+2 -2
fs/nfsd/state.h
··· 603 603 __be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, 604 604 stateid_t *stateid, unsigned char typemask, 605 605 struct nfs4_stid **s, struct nfsd_net *nn); 606 - struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, 607 - struct kmem_cache *slab); 606 + struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, 607 + void (*sc_free)(struct nfs4_stid *)); 608 608 void nfs4_unhash_stid(struct nfs4_stid *s); 609 609 void nfs4_put_stid(struct nfs4_stid *s); 610 610 void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid);
+37 -60
fs/nfsd/vfs.c
··· 332 332 } 333 333 } 334 334 335 - static __be32 336 - nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, 337 - struct iattr *iap) 338 - { 339 - struct inode *inode = d_inode(fhp->fh_dentry); 340 - int host_err; 341 - 342 - if (iap->ia_size < inode->i_size) { 343 - __be32 err; 344 - 345 - err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, 346 - NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE); 347 - if (err) 348 - return err; 349 - } 350 - 351 - host_err = get_write_access(inode); 352 - if (host_err) 353 - goto out_nfserrno; 354 - 355 - host_err = locks_verify_truncate(inode, NULL, iap->ia_size); 356 - if (host_err) 357 - goto out_put_write_access; 358 - return 0; 359 - 360 - out_put_write_access: 361 - put_write_access(inode); 362 - out_nfserrno: 363 - return nfserrno(host_err); 364 - } 365 - 366 335 /* 367 336 * Set various file attributes. After this call fhp needs an fh_put. 368 337 */ ··· 346 377 __be32 err; 347 378 int host_err; 348 379 bool get_write_count; 349 - int size_change = 0; 350 380 351 381 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) 352 382 accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; ··· 358 390 /* Get inode */ 359 391 err = fh_verify(rqstp, fhp, ftype, accmode); 360 392 if (err) 361 - goto out; 393 + return err; 362 394 if (get_write_count) { 363 395 host_err = fh_want_write(fhp); 364 396 if (host_err) 365 - return nfserrno(host_err); 397 + goto out_host_err; 366 398 } 367 399 368 400 dentry = fhp->fh_dentry; ··· 373 405 iap->ia_valid &= ~ATTR_MODE; 374 406 375 407 if (!iap->ia_valid) 376 - goto out; 408 + return 0; 377 409 378 410 nfsd_sanitize_attrs(inode, iap); 379 411 412 + if (check_guard && guardtime != inode->i_ctime.tv_sec) 413 + return nfserr_notsync; 414 + 380 415 /* 381 416 * The size case is special, it changes the file in addition to the 382 - * attributes. 417 + * attributes, and file systems don't expect it to be mixed with 418 + * "random" attribute changes. We thus split out the size change 419 + * into a separate call for vfs_truncate, and do the rest as a 420 + * a separate setattr call. 383 421 */ 384 422 if (iap->ia_valid & ATTR_SIZE) { 385 - err = nfsd_get_write_access(rqstp, fhp, iap); 386 - if (err) 387 - goto out; 388 - size_change = 1; 423 + struct path path = { 424 + .mnt = fhp->fh_export->ex_path.mnt, 425 + .dentry = dentry, 426 + }; 427 + bool implicit_mtime = false; 389 428 390 429 /* 391 - * RFC5661, Section 18.30.4: 392 - * Changing the size of a file with SETATTR indirectly 393 - * changes the time_modify and change attributes. 394 - * 395 - * (and similar for the older RFCs) 430 + * vfs_truncate implicity updates the mtime IFF the file size 431 + * actually changes. Avoid the additional seattr call below if 432 + * the only other attribute that the client sends is the mtime. 396 433 */ 397 - if (iap->ia_size != i_size_read(inode)) 398 - iap->ia_valid |= ATTR_MTIME; 434 + if (iap->ia_size != i_size_read(inode) && 435 + ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0)) 436 + implicit_mtime = true; 437 + 438 + host_err = vfs_truncate(&path, iap->ia_size); 439 + if (host_err) 440 + goto out_host_err; 441 + 442 + iap->ia_valid &= ~ATTR_SIZE; 443 + if (implicit_mtime) 444 + iap->ia_valid &= ~ATTR_MTIME; 445 + if (!iap->ia_valid) 446 + goto done; 399 447 } 400 448 401 449 iap->ia_valid |= ATTR_CTIME; 402 450 403 - if (check_guard && guardtime != inode->i_ctime.tv_sec) { 404 - err = nfserr_notsync; 405 - goto out_put_write_access; 406 - } 407 - 408 451 fh_lock(fhp); 409 452 host_err = notify_change(dentry, iap, NULL); 410 453 fh_unlock(fhp); 411 - err = nfserrno(host_err); 454 + if (host_err) 455 + goto out_host_err; 412 456 413 - out_put_write_access: 414 - if (size_change) 415 - put_write_access(inode); 416 - if (!err) 417 - err = nfserrno(commit_metadata(fhp)); 418 - out: 419 - return err; 457 + done: 458 + host_err = commit_metadata(fhp); 459 + out_host_err: 460 + return nfserrno(host_err); 420 461 } 421 462 422 463 #if defined(CONFIG_NFSD_V4)
+1 -1
net/sunrpc/auth_gss/gss_rpc_xdr.c
··· 260 260 if (!oa->data) 261 261 return -ENOMEM; 262 262 263 - creds = kmalloc(sizeof(struct svc_cred), GFP_KERNEL); 263 + creds = kzalloc(sizeof(struct svc_cred), GFP_KERNEL); 264 264 if (!creds) { 265 265 kfree(oa->data); 266 266 return -ENOMEM;