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 '9p-for-5.9-rc1' of git://github.com/martinetd/linux

Pull 9p updates from Dominique Martinet:

- some code cleanup

- a couple of static analysis fixes

- setattr: try to pick a fid associated with the file rather than the
dentry, which might sometimes matter

* tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux:
9p: Remove unneeded cast from memory allocation
9p: remove unused code in 9p
net/9p: Fix sparse endian warning in trans_fd.c
9p: Fix memory leak in v9fs_mount
9p: retrieve fid from file when file instance exist.

+18 -63
+2 -3
fs/9p/v9fs.c
··· 500 500 } 501 501 502 502 #ifdef CONFIG_9P_FSCACHE 503 - if (v9ses->fscache) { 503 + if (v9ses->fscache) 504 504 v9fs_cache_session_put_cookie(v9ses); 505 - kfree(v9ses->cachetag); 506 - } 505 + kfree(v9ses->cachetag); 507 506 #endif 508 507 kfree(v9ses->uname); 509 508 kfree(v9ses->aname);
+8 -57
fs/9p/vfs_inode.c
··· 223 223 struct inode *v9fs_alloc_inode(struct super_block *sb) 224 224 { 225 225 struct v9fs_inode *v9inode; 226 - v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache, 227 - GFP_KERNEL); 226 + v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL); 228 227 if (!v9inode) 229 228 return NULL; 230 229 #ifdef CONFIG_9P_FSCACHE ··· 366 367 } 367 368 return inode; 368 369 } 369 - 370 - /* 371 - static struct v9fs_fid* 372 - v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry) 373 - { 374 - int err; 375 - int nfid; 376 - struct v9fs_fid *ret; 377 - struct v9fs_fcall *fcall; 378 - 379 - nfid = v9fs_get_idpool(&v9ses->fidpool); 380 - if (nfid < 0) { 381 - eprintk(KERN_WARNING, "no free fids available\n"); 382 - return ERR_PTR(-ENOSPC); 383 - } 384 - 385 - err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name, 386 - &fcall); 387 - 388 - if (err < 0) { 389 - if (fcall && fcall->id == RWALK) 390 - goto clunk_fid; 391 - 392 - PRINT_FCALL_ERROR("walk error", fcall); 393 - v9fs_put_idpool(nfid, &v9ses->fidpool); 394 - goto error; 395 - } 396 - 397 - kfree(fcall); 398 - fcall = NULL; 399 - ret = v9fs_fid_create(v9ses, nfid); 400 - if (!ret) { 401 - err = -ENOMEM; 402 - goto clunk_fid; 403 - } 404 - 405 - err = v9fs_fid_insert(ret, dentry); 406 - if (err < 0) { 407 - v9fs_fid_destroy(ret); 408 - goto clunk_fid; 409 - } 410 - 411 - return ret; 412 - 413 - clunk_fid: 414 - v9fs_t_clunk(v9ses, nfid); 415 - 416 - error: 417 - kfree(fcall); 418 - return ERR_PTR(err); 419 - } 420 - */ 421 - 422 370 423 371 /** 424 372 * v9fs_clear_inode - release an inode ··· 1036 1090 { 1037 1091 int retval; 1038 1092 struct v9fs_session_info *v9ses; 1039 - struct p9_fid *fid; 1093 + struct p9_fid *fid = NULL; 1040 1094 struct p9_wstat wstat; 1041 1095 1042 1096 p9_debug(P9_DEBUG_VFS, "\n"); ··· 1046 1100 1047 1101 retval = -EPERM; 1048 1102 v9ses = v9fs_dentry2v9ses(dentry); 1049 - fid = v9fs_fid_lookup(dentry); 1103 + if (iattr->ia_valid & ATTR_FILE) { 1104 + fid = iattr->ia_file->private_data; 1105 + WARN_ON(!fid); 1106 + } 1107 + if (!fid) 1108 + fid = v9fs_fid_lookup(dentry); 1050 1109 if(IS_ERR(fid)) 1051 1110 return PTR_ERR(fid); 1052 1111
+7 -2
fs/9p/vfs_inode_dotl.c
··· 540 540 int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) 541 541 { 542 542 int retval; 543 - struct p9_fid *fid; 543 + struct p9_fid *fid = NULL; 544 544 struct p9_iattr_dotl p9attr; 545 545 struct inode *inode = d_inode(dentry); 546 546 ··· 560 560 p9attr.mtime_sec = iattr->ia_mtime.tv_sec; 561 561 p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec; 562 562 563 - fid = v9fs_fid_lookup(dentry); 563 + if (iattr->ia_valid & ATTR_FILE) { 564 + fid = iattr->ia_file->private_data; 565 + WARN_ON(!fid); 566 + } 567 + if (!fid) 568 + fid = v9fs_fid_lookup(dentry); 564 569 if (IS_ERR(fid)) 565 570 return PTR_ERR(fid); 566 571
+1 -1
net/9p/trans_fd.c
··· 950 950 951 951 memset(&cl, 0, sizeof(cl)); 952 952 cl.sin_family = AF_INET; 953 - cl.sin_addr.s_addr = INADDR_ANY; 953 + cl.sin_addr.s_addr = htonl(INADDR_ANY); 954 954 for (port = p9_ipport_resv_max; port >= p9_ipport_resv_min; port--) { 955 955 cl.sin_port = htons((ushort)port); 956 956 err = kernel_bind(sock, (struct sockaddr *)&cl, sizeof(cl));