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 branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
net/9p: nwname should be an unsigned int
9p: Fix sparse error
fs/9p: Fix error reported by coccicheck
9p: revert tsyncfs related changes
fs/9p: Use write_inode for data sync on server
fs/9p: Fix revalidate to return correct value

+84 -78
+2 -13
fs/9p/fid.c
··· 286 286 287 287 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) 288 288 { 289 - int err, flags; 289 + int err; 290 290 struct p9_fid *fid; 291 - struct v9fs_session_info *v9ses; 292 291 293 - v9ses = v9fs_dentry2v9ses(dentry); 294 292 fid = v9fs_fid_clone_with_uid(dentry, 0); 295 293 if (IS_ERR(fid)) 296 294 goto error_out; ··· 297 299 * dirty pages. We always request for the open fid in read-write 298 300 * mode so that a partial page write which result in page 299 301 * read can work. 300 - * 301 - * we don't have a tsyncfs operation for older version 302 - * of protocol. So make sure the write back fid is 303 - * opened in O_SYNC mode. 304 302 */ 305 - if (!v9fs_proto_dotl(v9ses)) 306 - flags = O_RDWR | O_SYNC; 307 - else 308 - flags = O_RDWR; 309 - 310 - err = p9_client_open(fid, flags); 303 + err = p9_client_open(fid, O_RDWR); 311 304 if (err < 0) { 312 305 p9_client_clunk(fid); 313 306 fid = ERR_PTR(err);
-1
fs/9p/v9fs.h
··· 116 116 struct list_head slist; /* list of sessions registered with v9fs */ 117 117 struct backing_dev_info bdi; 118 118 struct rw_semaphore rename_sem; 119 - struct p9_fid *root_fid; /* Used for file system sync */ 120 119 }; 121 120 122 121 /* cache_validity flags */
+3 -1
fs/9p/vfs_dentry.c
··· 126 126 retval = v9fs_refresh_inode_dotl(fid, inode); 127 127 else 128 128 retval = v9fs_refresh_inode(fid, inode); 129 - if (retval <= 0) 129 + if (retval == -ENOENT) 130 + return 0; 131 + if (retval < 0) 130 132 return retval; 131 133 } 132 134 out_valid:
+1 -1
fs/9p/vfs_inode_dotl.c
··· 811 811 fid = v9fs_fid_lookup(dentry); 812 812 if (IS_ERR(fid)) { 813 813 __putname(link); 814 - link = ERR_PTR(PTR_ERR(fid)); 814 + link = ERR_CAST(fid); 815 815 goto ndset; 816 816 } 817 817 retval = p9_client_readlink(fid, &target);
+56 -24
fs/9p/vfs_super.c
··· 154 154 retval = PTR_ERR(inode); 155 155 goto release_sb; 156 156 } 157 + 157 158 root = d_alloc_root(inode); 158 159 if (!root) { 159 160 iput(inode); ··· 186 185 p9stat_free(st); 187 186 kfree(st); 188 187 } 189 - v9fs_fid_add(root, fid); 190 188 retval = v9fs_get_acl(inode, fid); 191 189 if (retval) 192 190 goto release_sb; 193 - /* 194 - * Add the root fid to session info. This is used 195 - * for file system sync. We want a cloned fid here 196 - * so that we can do a sync_filesystem after a 197 - * shrink_dcache_for_umount 198 - */ 199 - v9ses->root_fid = v9fs_fid_clone(root); 200 - if (IS_ERR(v9ses->root_fid)) { 201 - retval = PTR_ERR(v9ses->root_fid); 202 - goto release_sb; 203 - } 191 + v9fs_fid_add(root, fid); 204 192 205 193 P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); 206 194 return dget(sb->s_root); ··· 200 210 v9fs_session_close(v9ses); 201 211 kfree(v9ses); 202 212 return ERR_PTR(retval); 213 + 203 214 release_sb: 204 215 /* 205 - * we will do the session_close and root dentry 206 - * release in the below call. 216 + * we will do the session_close and root dentry release 217 + * in the below call. But we need to clunk fid, because we haven't 218 + * attached the fid to dentry so it won't get clunked 219 + * automatically. 207 220 */ 221 + p9_client_clunk(fid); 208 222 deactivate_locked_super(sb); 209 223 return ERR_PTR(retval); 210 224 } ··· 226 232 P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); 227 233 228 234 kill_anon_super(s); 229 - p9_client_clunk(v9ses->root_fid); 235 + 230 236 v9fs_session_cancel(v9ses); 231 237 v9fs_session_close(v9ses); 232 238 kfree(v9ses); ··· 279 285 return res; 280 286 } 281 287 282 - static int v9fs_sync_fs(struct super_block *sb, int wait) 283 - { 284 - struct v9fs_session_info *v9ses = sb->s_fs_info; 285 - 286 - P9_DPRINTK(P9_DEBUG_VFS, "v9fs_sync_fs: super_block %p\n", sb); 287 - return p9_client_sync_fs(v9ses->root_fid); 288 - } 289 - 290 288 static int v9fs_drop_inode(struct inode *inode) 291 289 { 292 290 struct v9fs_session_info *v9ses; ··· 293 307 return 1; 294 308 } 295 309 310 + static int v9fs_write_inode(struct inode *inode, 311 + struct writeback_control *wbc) 312 + { 313 + int ret; 314 + struct p9_wstat wstat; 315 + struct v9fs_inode *v9inode; 316 + /* 317 + * send an fsync request to server irrespective of 318 + * wbc->sync_mode. 319 + */ 320 + P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); 321 + v9inode = V9FS_I(inode); 322 + if (!v9inode->writeback_fid) 323 + return 0; 324 + v9fs_blank_wstat(&wstat); 325 + 326 + ret = p9_client_wstat(v9inode->writeback_fid, &wstat); 327 + if (ret < 0) { 328 + __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 329 + return ret; 330 + } 331 + return 0; 332 + } 333 + 334 + static int v9fs_write_inode_dotl(struct inode *inode, 335 + struct writeback_control *wbc) 336 + { 337 + int ret; 338 + struct v9fs_inode *v9inode; 339 + /* 340 + * send an fsync request to server irrespective of 341 + * wbc->sync_mode. 342 + */ 343 + P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); 344 + v9inode = V9FS_I(inode); 345 + if (!v9inode->writeback_fid) 346 + return 0; 347 + ret = p9_client_fsync(v9inode->writeback_fid, 0); 348 + if (ret < 0) { 349 + __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 350 + return ret; 351 + } 352 + return 0; 353 + } 354 + 296 355 static const struct super_operations v9fs_super_ops = { 297 356 .alloc_inode = v9fs_alloc_inode, 298 357 .destroy_inode = v9fs_destroy_inode, ··· 345 314 .evict_inode = v9fs_evict_inode, 346 315 .show_options = generic_show_options, 347 316 .umount_begin = v9fs_umount_begin, 317 + .write_inode = v9fs_write_inode, 348 318 }; 349 319 350 320 static const struct super_operations v9fs_super_ops_dotl = { 351 321 .alloc_inode = v9fs_alloc_inode, 352 322 .destroy_inode = v9fs_destroy_inode, 353 - .sync_fs = v9fs_sync_fs, 354 323 .statfs = v9fs_statfs, 355 324 .drop_inode = v9fs_drop_inode, 356 325 .evict_inode = v9fs_evict_inode, 357 326 .show_options = generic_show_options, 358 327 .umount_begin = v9fs_umount_begin, 328 + .write_inode = v9fs_write_inode_dotl, 359 329 }; 360 330 361 331 struct file_system_type v9fs_fs_type = {
-2
include/net/9p/9p.h
··· 139 139 */ 140 140 141 141 enum p9_msg_t { 142 - P9_TSYNCFS = 0, 143 - P9_RSYNCFS, 144 142 P9_TLERROR = 6, 145 143 P9_RLERROR, 146 144 P9_TSTATFS = 8,
+2 -3
include/net/9p/client.h
··· 218 218 void p9_client_begin_disconnect(struct p9_client *clnt); 219 219 struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, 220 220 char *uname, u32 n_uname, char *aname); 221 - struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, 222 - int clone); 221 + struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, 222 + char **wnames, int clone); 223 223 int p9_client_open(struct p9_fid *fid, int mode); 224 224 int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, 225 225 char *extension); ··· 230 230 gid_t gid, struct p9_qid *qid); 231 231 int p9_client_clunk(struct p9_fid *fid); 232 232 int p9_client_fsync(struct p9_fid *fid, int datasync); 233 - int p9_client_sync_fs(struct p9_fid *fid); 234 233 int p9_client_remove(struct p9_fid *fid); 235 234 int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 236 235 u64 offset, u32 count);
+4 -25
net/9p/client.c
··· 929 929 } 930 930 EXPORT_SYMBOL(p9_client_attach); 931 931 932 - struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, 933 - int clone) 932 + struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, 933 + char **wnames, int clone) 934 934 { 935 935 int err; 936 936 struct p9_client *clnt; 937 937 struct p9_fid *fid; 938 938 struct p9_qid *wqids; 939 939 struct p9_req_t *req; 940 - int16_t nwqids, count; 940 + uint16_t nwqids, count; 941 941 942 942 err = 0; 943 943 wqids = NULL; ··· 955 955 fid = oldfid; 956 956 957 957 958 - P9_DPRINTK(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %d wname[0] %s\n", 958 + P9_DPRINTK(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %ud wname[0] %s\n", 959 959 oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL); 960 960 961 961 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, ··· 1219 1219 return err; 1220 1220 } 1221 1221 EXPORT_SYMBOL(p9_client_fsync); 1222 - 1223 - int p9_client_sync_fs(struct p9_fid *fid) 1224 - { 1225 - int err = 0; 1226 - struct p9_req_t *req; 1227 - struct p9_client *clnt; 1228 - 1229 - P9_DPRINTK(P9_DEBUG_9P, ">>> TSYNC_FS fid %d\n", fid->fid); 1230 - 1231 - clnt = fid->clnt; 1232 - req = p9_client_rpc(clnt, P9_TSYNCFS, "d", fid->fid); 1233 - if (IS_ERR(req)) { 1234 - err = PTR_ERR(req); 1235 - goto error; 1236 - } 1237 - P9_DPRINTK(P9_DEBUG_9P, "<<< RSYNCFS fid %d\n", fid->fid); 1238 - p9_free_req(clnt, req); 1239 - error: 1240 - return err; 1241 - } 1242 - EXPORT_SYMBOL(p9_client_sync_fs); 1243 1222 1244 1223 int p9_client_clunk(struct p9_fid *fid) 1245 1224 {
+4 -3
net/9p/protocol.c
··· 265 265 } 266 266 break; 267 267 case 'T':{ 268 - int16_t *nwname = va_arg(ap, int16_t *); 268 + uint16_t *nwname = va_arg(ap, uint16_t *); 269 269 char ***wnames = va_arg(ap, char ***); 270 270 271 271 errcode = p9pdu_readf(pdu, proto_version, ··· 468 468 case 'E':{ 469 469 int32_t cnt = va_arg(ap, int32_t); 470 470 const char *k = va_arg(ap, const void *); 471 - const char *u = va_arg(ap, const void *); 471 + const char __user *u = va_arg(ap, 472 + const void __user *); 472 473 errcode = p9pdu_writef(pdu, proto_version, "d", 473 474 cnt); 474 475 if (!errcode && pdu_write_urw(pdu, k, u, cnt)) ··· 496 495 } 497 496 break; 498 497 case 'T':{ 499 - int16_t nwname = va_arg(ap, int); 498 + uint16_t nwname = va_arg(ap, int); 500 499 const char **wnames = va_arg(ap, const char **); 501 500 502 501 errcode = p9pdu_writef(pdu, proto_version, "w",
+1 -1
net/9p/trans_common.c
··· 66 66 uint32_t pdata_mapped_pages; 67 67 struct trans_rpage_info *rpinfo; 68 68 69 - *pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1); 69 + *pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1); 70 70 71 71 if (*pdata_off) 72 72 first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off),
+11 -4
net/9p/trans_virtio.c
··· 326 326 outp = pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM, 327 327 pdata_off, rpinfo->rp_data, pdata_len); 328 328 } else { 329 - char *pbuf = req->tc->pubuf ? req->tc->pubuf : 330 - req->tc->pkbuf; 329 + char *pbuf; 330 + if (req->tc->pubuf) 331 + pbuf = (__force char *) req->tc->pubuf; 332 + else 333 + pbuf = req->tc->pkbuf; 331 334 outp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, pbuf, 332 335 req->tc->pbuf_size); 333 336 } ··· 355 352 in = pack_sg_list_p(chan->sg, out+inp, VIRTQUEUE_NUM, 356 353 pdata_off, rpinfo->rp_data, pdata_len); 357 354 } else { 358 - char *pbuf = req->tc->pubuf ? req->tc->pubuf : 359 - req->tc->pkbuf; 355 + char *pbuf; 356 + if (req->tc->pubuf) 357 + pbuf = (__force char *) req->tc->pubuf; 358 + else 359 + pbuf = req->tc->pkbuf; 360 + 360 361 in = pack_sg_list(chan->sg, out+inp, VIRTQUEUE_NUM, 361 362 pbuf, req->tc->pbuf_size); 362 363 }