aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r--fs/9p/vfs_inode.c859
1 files changed, 808 insertions, 51 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index f2434fc9d2c4..d97c34a24f7a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -35,6 +35,7 @@
35#include <linux/idr.h> 35#include <linux/idr.h>
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/xattr.h>
38#include <net/9p/9p.h> 39#include <net/9p/9p.h>
39#include <net/9p/client.h> 40#include <net/9p/client.h>
40 41
@@ -42,11 +43,15 @@
42#include "v9fs_vfs.h" 43#include "v9fs_vfs.h"
43#include "fid.h" 44#include "fid.h"
44#include "cache.h" 45#include "cache.h"
46#include "xattr.h"
45 47
46static const struct inode_operations v9fs_dir_inode_operations; 48static const struct inode_operations v9fs_dir_inode_operations;
47static const struct inode_operations v9fs_dir_inode_operations_ext; 49static const struct inode_operations v9fs_dir_inode_operations_dotu;
50static const struct inode_operations v9fs_dir_inode_operations_dotl;
48static const struct inode_operations v9fs_file_inode_operations; 51static const struct inode_operations v9fs_file_inode_operations;
52static const struct inode_operations v9fs_file_inode_operations_dotl;
49static const struct inode_operations v9fs_symlink_inode_operations; 53static const struct inode_operations v9fs_symlink_inode_operations;
54static const struct inode_operations v9fs_symlink_inode_operations_dotl;
50 55
51/** 56/**
52 * unixmode2p9mode - convert unix mode bits to plan 9 57 * unixmode2p9mode - convert unix mode bits to plan 9
@@ -233,6 +238,41 @@ void v9fs_destroy_inode(struct inode *inode)
233#endif 238#endif
234 239
235/** 240/**
241 * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a
242 * new file system object. This checks the S_ISGID to determine the owning
243 * group of the new file system object.
244 */
245
246static gid_t v9fs_get_fsgid_for_create(struct inode *dir_inode)
247{
248 BUG_ON(dir_inode == NULL);
249
250 if (dir_inode->i_mode & S_ISGID) {
251 /* set_gid bit is set.*/
252 return dir_inode->i_gid;
253 }
254 return current_fsgid();
255}
256
257/**
258 * v9fs_dentry_from_dir_inode - helper function to get the dentry from
259 * dir inode.
260 *
261 */
262
263static struct dentry *v9fs_dentry_from_dir_inode(struct inode *inode)
264{
265 struct dentry *dentry;
266
267 spin_lock(&dcache_lock);
268 /* Directory should have only one entry. */
269 BUG_ON(S_ISDIR(inode->i_mode) && !list_is_singular(&inode->i_dentry));
270 dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
271 spin_unlock(&dcache_lock);
272 return dentry;
273}
274
275/**
236 * v9fs_get_inode - helper function to setup an inode 276 * v9fs_get_inode - helper function to setup an inode
237 * @sb: superblock 277 * @sb: superblock
238 * @mode: mode to setup inode with 278 * @mode: mode to setup inode with
@@ -253,9 +293,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
253 return ERR_PTR(-ENOMEM); 293 return ERR_PTR(-ENOMEM);
254 } 294 }
255 295
256 inode->i_mode = mode; 296 inode_init_owner(inode, NULL, mode);
257 inode->i_uid = current_fsuid();
258 inode->i_gid = current_fsgid();
259 inode->i_blocks = 0; 297 inode->i_blocks = 0;
260 inode->i_rdev = 0; 298 inode->i_rdev = 0;
261 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 299 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -266,7 +304,13 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
266 case S_IFBLK: 304 case S_IFBLK:
267 case S_IFCHR: 305 case S_IFCHR:
268 case S_IFSOCK: 306 case S_IFSOCK:
269 if (!v9fs_proto_dotu(v9ses)) { 307 if (v9fs_proto_dotl(v9ses)) {
308 inode->i_op = &v9fs_file_inode_operations_dotl;
309 inode->i_fop = &v9fs_file_operations_dotl;
310 } else if (v9fs_proto_dotu(v9ses)) {
311 inode->i_op = &v9fs_file_inode_operations;
312 inode->i_fop = &v9fs_file_operations;
313 } else {
270 P9_DPRINTK(P9_DEBUG_ERROR, 314 P9_DPRINTK(P9_DEBUG_ERROR,
271 "special files without extended mode\n"); 315 "special files without extended mode\n");
272 err = -EINVAL; 316 err = -EINVAL;
@@ -275,25 +319,44 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
275 init_special_inode(inode, inode->i_mode, inode->i_rdev); 319 init_special_inode(inode, inode->i_mode, inode->i_rdev);
276 break; 320 break;
277 case S_IFREG: 321 case S_IFREG:
278 inode->i_op = &v9fs_file_inode_operations; 322 if (v9fs_proto_dotl(v9ses)) {
279 inode->i_fop = &v9fs_file_operations; 323 inode->i_op = &v9fs_file_inode_operations_dotl;
324 inode->i_fop = &v9fs_file_operations_dotl;
325 } else {
326 inode->i_op = &v9fs_file_inode_operations;
327 inode->i_fop = &v9fs_file_operations;
328 }
329
280 break; 330 break;
331
281 case S_IFLNK: 332 case S_IFLNK:
282 if (!v9fs_proto_dotu(v9ses)) { 333 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
283 P9_DPRINTK(P9_DEBUG_ERROR, 334 P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
284 "extended modes used w/o 9P2000.u\n"); 335 "legacy protocol.\n");
285 err = -EINVAL; 336 err = -EINVAL;
286 goto error; 337 goto error;
287 } 338 }
288 inode->i_op = &v9fs_symlink_inode_operations; 339
340 if (v9fs_proto_dotl(v9ses))
341 inode->i_op = &v9fs_symlink_inode_operations_dotl;
342 else
343 inode->i_op = &v9fs_symlink_inode_operations;
344
289 break; 345 break;
290 case S_IFDIR: 346 case S_IFDIR:
291 inc_nlink(inode); 347 inc_nlink(inode);
292 if (v9fs_proto_dotu(v9ses)) 348 if (v9fs_proto_dotl(v9ses))
293 inode->i_op = &v9fs_dir_inode_operations_ext; 349 inode->i_op = &v9fs_dir_inode_operations_dotl;
350 else if (v9fs_proto_dotu(v9ses))
351 inode->i_op = &v9fs_dir_inode_operations_dotu;
294 else 352 else
295 inode->i_op = &v9fs_dir_inode_operations; 353 inode->i_op = &v9fs_dir_inode_operations;
296 inode->i_fop = &v9fs_dir_operations; 354
355 if (v9fs_proto_dotl(v9ses))
356 inode->i_fop = &v9fs_dir_operations_dotl;
357 else
358 inode->i_fop = &v9fs_dir_operations;
359
297 break; 360 break;
298 default: 361 default:
299 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", 362 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
@@ -367,8 +430,10 @@ error:
367 * @inode: inode to release 430 * @inode: inode to release
368 * 431 *
369 */ 432 */
370void v9fs_clear_inode(struct inode *inode) 433void v9fs_evict_inode(struct inode *inode)
371{ 434{
435 truncate_inode_pages(inode->i_mapping, 0);
436 end_writeback(inode);
372 filemap_fdatawrite(inode->i_mapping); 437 filemap_fdatawrite(inode->i_mapping);
373 438
374#ifdef CONFIG_9P_FSCACHE 439#ifdef CONFIG_9P_FSCACHE
@@ -376,23 +441,14 @@ void v9fs_clear_inode(struct inode *inode)
376#endif 441#endif
377} 442}
378 443
379/**
380 * v9fs_inode_from_fid - populate an inode by issuing a attribute request
381 * @v9ses: session information
382 * @fid: fid to issue attribute request for
383 * @sb: superblock on which to create inode
384 *
385 */
386
387static struct inode * 444static struct inode *
388v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, 445v9fs_inode(struct v9fs_session_info *v9ses, struct p9_fid *fid,
389 struct super_block *sb) 446 struct super_block *sb)
390{ 447{
391 int err, umode; 448 int err, umode;
392 struct inode *ret; 449 struct inode *ret = NULL;
393 struct p9_wstat *st; 450 struct p9_wstat *st;
394 451
395 ret = NULL;
396 st = p9_client_stat(fid); 452 st = p9_client_stat(fid);
397 if (IS_ERR(st)) 453 if (IS_ERR(st))
398 return ERR_CAST(st); 454 return ERR_CAST(st);
@@ -413,15 +469,62 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
413#endif 469#endif
414 p9stat_free(st); 470 p9stat_free(st);
415 kfree(st); 471 kfree(st);
416
417 return ret; 472 return ret;
418
419error: 473error:
420 p9stat_free(st); 474 p9stat_free(st);
421 kfree(st); 475 kfree(st);
422 return ERR_PTR(err); 476 return ERR_PTR(err);
423} 477}
424 478
479static struct inode *
480v9fs_inode_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid,
481 struct super_block *sb)
482{
483 struct inode *ret = NULL;
484 int err;
485 struct p9_stat_dotl *st;
486
487 st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
488 if (IS_ERR(st))
489 return ERR_CAST(st);
490
491 ret = v9fs_get_inode(sb, st->st_mode);
492 if (IS_ERR(ret)) {
493 err = PTR_ERR(ret);
494 goto error;
495 }
496
497 v9fs_stat2inode_dotl(st, ret);
498 ret->i_ino = v9fs_qid2ino(&st->qid);
499#ifdef CONFIG_9P_FSCACHE
500 v9fs_vcookie_set_qid(ret, &st->qid);
501 v9fs_cache_inode_get_cookie(ret);
502#endif
503 kfree(st);
504 return ret;
505error:
506 kfree(st);
507 return ERR_PTR(err);
508}
509
510/**
511 * v9fs_inode_from_fid - Helper routine to populate an inode by
512 * issuing a attribute request
513 * @v9ses: session information
514 * @fid: fid to issue attribute request for
515 * @sb: superblock on which to create inode
516 *
517 */
518static inline struct inode *
519v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
520 struct super_block *sb)
521{
522 if (v9fs_proto_dotl(v9ses))
523 return v9fs_inode_dotl(v9ses, fid, sb);
524 else
525 return v9fs_inode(v9ses, fid, sb);
526}
527
425/** 528/**
426 * v9fs_remove - helper function to remove files and directories 529 * v9fs_remove - helper function to remove files and directories
427 * @dir: directory inode that is being deleted 530 * @dir: directory inode that is being deleted
@@ -434,14 +537,12 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
434{ 537{
435 int retval; 538 int retval;
436 struct inode *file_inode; 539 struct inode *file_inode;
437 struct v9fs_session_info *v9ses;
438 struct p9_fid *v9fid; 540 struct p9_fid *v9fid;
439 541
440 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, 542 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file,
441 rmdir); 543 rmdir);
442 544
443 file_inode = file->d_inode; 545 file_inode = file->d_inode;
444 v9ses = v9fs_inode2v9ses(file_inode);
445 v9fid = v9fs_fid_clone(file); 546 v9fid = v9fs_fid_clone(file);
446 if (IS_ERR(v9fid)) 547 if (IS_ERR(v9fid))
447 return PTR_ERR(v9fid); 548 return PTR_ERR(v9fid);
@@ -484,12 +585,11 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
484 ofid = NULL; 585 ofid = NULL;
485 fid = NULL; 586 fid = NULL;
486 name = (char *) dentry->d_name.name; 587 name = (char *) dentry->d_name.name;
487 dfid = v9fs_fid_clone(dentry->d_parent); 588 dfid = v9fs_fid_lookup(dentry->d_parent);
488 if (IS_ERR(dfid)) { 589 if (IS_ERR(dfid)) {
489 err = PTR_ERR(dfid); 590 err = PTR_ERR(dfid);
490 P9_DPRINTK(P9_DEBUG_VFS, "fid clone failed %d\n", err); 591 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
491 dfid = NULL; 592 return ERR_PTR(err);
492 goto error;
493 } 593 }
494 594
495 /* clone a fid to use for creation */ 595 /* clone a fid to use for creation */
@@ -497,8 +597,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
497 if (IS_ERR(ofid)) { 597 if (IS_ERR(ofid)) {
498 err = PTR_ERR(ofid); 598 err = PTR_ERR(ofid);
499 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 599 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
500 ofid = NULL; 600 return ERR_PTR(err);
501 goto error;
502 } 601 }
503 602
504 err = p9_client_fcreate(ofid, name, perm, mode, extension); 603 err = p9_client_fcreate(ofid, name, perm, mode, extension);
@@ -508,14 +607,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
508 } 607 }
509 608
510 /* now walk from the parent so we can get unopened fid */ 609 /* now walk from the parent so we can get unopened fid */
511 fid = p9_client_walk(dfid, 1, &name, 0); 610 fid = p9_client_walk(dfid, 1, &name, 1);
512 if (IS_ERR(fid)) { 611 if (IS_ERR(fid)) {
513 err = PTR_ERR(fid); 612 err = PTR_ERR(fid);
514 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 613 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
515 fid = NULL; 614 fid = NULL;
516 goto error; 615 goto error;
517 } else 616 }
518 dfid = NULL;
519 617
520 /* instantiate inode and assign the unopened fid to the dentry */ 618 /* instantiate inode and assign the unopened fid to the dentry */
521 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); 619 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
@@ -538,9 +636,6 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
538 return ofid; 636 return ofid;
539 637
540error: 638error:
541 if (dfid)
542 p9_client_clunk(dfid);
543
544 if (ofid) 639 if (ofid)
545 p9_client_clunk(ofid); 640 p9_client_clunk(ofid);
546 641
@@ -551,6 +646,118 @@ error:
551} 646}
552 647
553/** 648/**
649 * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol.
650 * @dir: directory inode that is being created
651 * @dentry: dentry that is being deleted
652 * @mode: create permissions
653 * @nd: path information
654 *
655 */
656
657static int
658v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int mode,
659 struct nameidata *nd)
660{
661 int err = 0;
662 char *name = NULL;
663 gid_t gid;
664 int flags;
665 struct v9fs_session_info *v9ses;
666 struct p9_fid *fid = NULL;
667 struct p9_fid *dfid, *ofid;
668 struct file *filp;
669 struct p9_qid qid;
670 struct inode *inode;
671
672 v9ses = v9fs_inode2v9ses(dir);
673 if (nd && nd->flags & LOOKUP_OPEN)
674 flags = nd->intent.open.flags - 1;
675 else
676 flags = O_RDWR;
677
678 name = (char *) dentry->d_name.name;
679 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
680 "mode:0x%x\n", name, flags, mode);
681
682 dfid = v9fs_fid_lookup(dentry->d_parent);
683 if (IS_ERR(dfid)) {
684 err = PTR_ERR(dfid);
685 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
686 return err;
687 }
688
689 /* clone a fid to use for creation */
690 ofid = p9_client_walk(dfid, 0, NULL, 1);
691 if (IS_ERR(ofid)) {
692 err = PTR_ERR(ofid);
693 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
694 return err;
695 }
696
697 gid = v9fs_get_fsgid_for_create(dir);
698 err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid);
699 if (err < 0) {
700 P9_DPRINTK(P9_DEBUG_VFS,
701 "p9_client_open_dotl failed in creat %d\n",
702 err);
703 goto error;
704 }
705
706 /* No need to populate the inode if we are not opening the file AND
707 * not in cached mode.
708 */
709 if (!v9ses->cache && !(nd && nd->flags & LOOKUP_OPEN)) {
710 /* Not in cached mode. No need to populate inode with stat */
711 dentry->d_op = &v9fs_dentry_operations;
712 p9_client_clunk(ofid);
713 d_instantiate(dentry, NULL);
714 return 0;
715 }
716
717 /* Now walk from the parent so we can get an unopened fid. */
718 fid = p9_client_walk(dfid, 1, &name, 1);
719 if (IS_ERR(fid)) {
720 err = PTR_ERR(fid);
721 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
722 fid = NULL;
723 goto error;
724 }
725
726 /* instantiate inode and assign the unopened fid to dentry */
727 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
728 if (IS_ERR(inode)) {
729 err = PTR_ERR(inode);
730 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
731 goto error;
732 }
733 dentry->d_op = &v9fs_cached_dentry_operations;
734 d_instantiate(dentry, inode);
735 err = v9fs_fid_add(dentry, fid);
736 if (err < 0)
737 goto error;
738
739 /* if we are opening a file, assign the open fid to the file */
740 if (nd && nd->flags & LOOKUP_OPEN) {
741 filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
742 if (IS_ERR(filp)) {
743 p9_client_clunk(ofid);
744 return PTR_ERR(filp);
745 }
746 filp->private_data = ofid;
747 } else
748 p9_client_clunk(ofid);
749
750 return 0;
751
752error:
753 if (ofid)
754 p9_client_clunk(ofid);
755 if (fid)
756 p9_client_clunk(fid);
757 return err;
758}
759
760/**
554 * v9fs_vfs_create - VFS hook to create files 761 * v9fs_vfs_create - VFS hook to create files
555 * @dir: directory inode that is being created 762 * @dir: directory inode that is being created
556 * @dentry: dentry that is being deleted 763 * @dentry: dentry that is being deleted
@@ -640,6 +847,83 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
640 return err; 847 return err;
641} 848}
642 849
850
851/**
852 * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory
853 * @dir: inode that is being unlinked
854 * @dentry: dentry that is being unlinked
855 * @mode: mode for new directory
856 *
857 */
858
859static int v9fs_vfs_mkdir_dotl(struct inode *dir, struct dentry *dentry,
860 int mode)
861{
862 int err;
863 struct v9fs_session_info *v9ses;
864 struct p9_fid *fid = NULL, *dfid = NULL;
865 gid_t gid;
866 char *name;
867 struct inode *inode;
868 struct p9_qid qid;
869 struct dentry *dir_dentry;
870
871 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
872 err = 0;
873 v9ses = v9fs_inode2v9ses(dir);
874
875 mode |= S_IFDIR;
876 dir_dentry = v9fs_dentry_from_dir_inode(dir);
877 dfid = v9fs_fid_lookup(dir_dentry);
878 if (IS_ERR(dfid)) {
879 err = PTR_ERR(dfid);
880 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
881 dfid = NULL;
882 goto error;
883 }
884
885 gid = v9fs_get_fsgid_for_create(dir);
886 if (gid < 0) {
887 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_get_fsgid_for_create failed\n");
888 goto error;
889 }
890
891 name = (char *) dentry->d_name.name;
892 err = p9_client_mkdir_dotl(dfid, name, mode, gid, &qid);
893 if (err < 0)
894 goto error;
895
896 /* instantiate inode and assign the unopened fid to the dentry */
897 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
898 fid = p9_client_walk(dfid, 1, &name, 1);
899 if (IS_ERR(fid)) {
900 err = PTR_ERR(fid);
901 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
902 err);
903 fid = NULL;
904 goto error;
905 }
906
907 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
908 if (IS_ERR(inode)) {
909 err = PTR_ERR(inode);
910 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
911 err);
912 goto error;
913 }
914 dentry->d_op = &v9fs_cached_dentry_operations;
915 d_instantiate(dentry, inode);
916 err = v9fs_fid_add(dentry, fid);
917 if (err < 0)
918 goto error;
919 fid = NULL;
920 }
921error:
922 if (fid)
923 p9_client_clunk(fid);
924 return err;
925}
926
643/** 927/**
644 * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode 928 * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode
645 * @dir: inode that is being walked from 929 * @dir: inode that is being walked from
@@ -666,6 +950,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
666 950
667 sb = dir->i_sb; 951 sb = dir->i_sb;
668 v9ses = v9fs_inode2v9ses(dir); 952 v9ses = v9fs_inode2v9ses(dir);
953 /* We can walk d_parent because we hold the dir->i_mutex */
669 dfid = v9fs_fid_lookup(dentry->d_parent); 954 dfid = v9fs_fid_lookup(dentry->d_parent);
670 if (IS_ERR(dfid)) 955 if (IS_ERR(dfid))
671 return ERR_CAST(dfid); 956 return ERR_CAST(dfid);
@@ -675,8 +960,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
675 if (IS_ERR(fid)) { 960 if (IS_ERR(fid)) {
676 result = PTR_ERR(fid); 961 result = PTR_ERR(fid);
677 if (result == -ENOENT) { 962 if (result == -ENOENT) {
678 d_add(dentry, NULL); 963 inode = NULL;
679 return NULL; 964 goto inst_out;
680 } 965 }
681 966
682 return ERR_PTR(result); 967 return ERR_PTR(result);
@@ -693,7 +978,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
693 if (result < 0) 978 if (result < 0)
694 goto error; 979 goto error;
695 980
696 if ((fid->qid.version) && (v9ses->cache)) 981inst_out:
982 if (v9ses->cache)
697 dentry->d_op = &v9fs_cached_dentry_operations; 983 dentry->d_op = &v9fs_cached_dentry_operations;
698 else 984 else
699 dentry->d_op = &v9fs_dentry_operations; 985 dentry->d_op = &v9fs_dentry_operations;
@@ -772,20 +1058,33 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
772 goto clunk_olddir; 1058 goto clunk_olddir;
773 } 1059 }
774 1060
775 /* 9P can only handle file rename in the same directory */ 1061 down_write(&v9ses->rename_sem);
776 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) { 1062 if (v9fs_proto_dotl(v9ses)) {
1063 retval = p9_client_rename(oldfid, newdirfid,
1064 (char *) new_dentry->d_name.name);
1065 if (retval != -ENOSYS)
1066 goto clunk_newdir;
1067 }
1068 if (old_dentry->d_parent != new_dentry->d_parent) {
1069 /*
1070 * 9P .u can only handle file rename in the same directory
1071 */
1072
777 P9_DPRINTK(P9_DEBUG_ERROR, 1073 P9_DPRINTK(P9_DEBUG_ERROR,
778 "old dir and new dir are different\n"); 1074 "old dir and new dir are different\n");
779 retval = -EXDEV; 1075 retval = -EXDEV;
780 goto clunk_newdir; 1076 goto clunk_newdir;
781 } 1077 }
782
783 v9fs_blank_wstat(&wstat); 1078 v9fs_blank_wstat(&wstat);
784 wstat.muid = v9ses->uname; 1079 wstat.muid = v9ses->uname;
785 wstat.name = (char *) new_dentry->d_name.name; 1080 wstat.name = (char *) new_dentry->d_name.name;
786 retval = p9_client_wstat(oldfid, &wstat); 1081 retval = p9_client_wstat(oldfid, &wstat);
787 1082
788clunk_newdir: 1083clunk_newdir:
1084 if (!retval)
1085 /* successful rename */
1086 d_move(old_dentry, new_dentry);
1087 up_write(&v9ses->rename_sem);
789 p9_client_clunk(newdirfid); 1088 p9_client_clunk(newdirfid);
790 1089
791clunk_olddir: 1090clunk_olddir:
@@ -833,6 +1132,42 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
833 return 0; 1132 return 0;
834} 1133}
835 1134
1135static int
1136v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
1137 struct kstat *stat)
1138{
1139 int err;
1140 struct v9fs_session_info *v9ses;
1141 struct p9_fid *fid;
1142 struct p9_stat_dotl *st;
1143
1144 P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
1145 err = -EPERM;
1146 v9ses = v9fs_inode2v9ses(dentry->d_inode);
1147 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
1148 return simple_getattr(mnt, dentry, stat);
1149
1150 fid = v9fs_fid_lookup(dentry);
1151 if (IS_ERR(fid))
1152 return PTR_ERR(fid);
1153
1154 /* Ask for all the fields in stat structure. Server will return
1155 * whatever it supports
1156 */
1157
1158 st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
1159 if (IS_ERR(st))
1160 return PTR_ERR(st);
1161
1162 v9fs_stat2inode_dotl(st, dentry->d_inode);
1163 generic_fillattr(dentry->d_inode, stat);
1164 /* Change block size to what the server returned */
1165 stat->blksize = st->st_blksize;
1166
1167 kfree(st);
1168 return 0;
1169}
1170
836/** 1171/**
837 * v9fs_vfs_setattr - set file metadata 1172 * v9fs_vfs_setattr - set file metadata
838 * @dentry: file whose metadata to set 1173 * @dentry: file whose metadata to set
@@ -876,6 +1211,58 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
876 } 1211 }
877 1212
878 retval = p9_client_wstat(fid, &wstat); 1213 retval = p9_client_wstat(fid, &wstat);
1214 if (retval < 0)
1215 return retval;
1216
1217 if ((iattr->ia_valid & ATTR_SIZE) &&
1218 iattr->ia_size != i_size_read(dentry->d_inode)) {
1219 retval = vmtruncate(dentry->d_inode, iattr->ia_size);
1220 if (retval)
1221 return retval;
1222 }
1223
1224 setattr_copy(dentry->d_inode, iattr);
1225 mark_inode_dirty(dentry->d_inode);
1226 return 0;
1227}
1228
1229/**
1230 * v9fs_vfs_setattr_dotl - set file metadata
1231 * @dentry: file whose metadata to set
1232 * @iattr: metadata assignment structure
1233 *
1234 */
1235
1236static int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
1237{
1238 int retval;
1239 struct v9fs_session_info *v9ses;
1240 struct p9_fid *fid;
1241 struct p9_iattr_dotl p9attr;
1242
1243 P9_DPRINTK(P9_DEBUG_VFS, "\n");
1244
1245 retval = inode_change_ok(dentry->d_inode, iattr);
1246 if (retval)
1247 return retval;
1248
1249 p9attr.valid = iattr->ia_valid;
1250 p9attr.mode = iattr->ia_mode;
1251 p9attr.uid = iattr->ia_uid;
1252 p9attr.gid = iattr->ia_gid;
1253 p9attr.size = iattr->ia_size;
1254 p9attr.atime_sec = iattr->ia_atime.tv_sec;
1255 p9attr.atime_nsec = iattr->ia_atime.tv_nsec;
1256 p9attr.mtime_sec = iattr->ia_mtime.tv_sec;
1257 p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec;
1258
1259 retval = -EPERM;
1260 v9ses = v9fs_inode2v9ses(dentry->d_inode);
1261 fid = v9fs_fid_lookup(dentry);
1262 if (IS_ERR(fid))
1263 return PTR_ERR(fid);
1264
1265 retval = p9_client_setattr(fid, &p9attr);
879 if (retval >= 0) 1266 if (retval >= 0)
880 retval = inode_setattr(dentry->d_inode, iattr); 1267 retval = inode_setattr(dentry->d_inode, iattr);
881 1268
@@ -960,6 +1347,77 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
960} 1347}
961 1348
962/** 1349/**
1350 * v9fs_stat2inode_dotl - populate an inode structure with stat info
1351 * @stat: stat structure
1352 * @inode: inode to populate
1353 * @sb: superblock of filesystem
1354 *
1355 */
1356
1357void
1358v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
1359{
1360
1361 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) {
1362 inode->i_atime.tv_sec = stat->st_atime_sec;
1363 inode->i_atime.tv_nsec = stat->st_atime_nsec;
1364 inode->i_mtime.tv_sec = stat->st_mtime_sec;
1365 inode->i_mtime.tv_nsec = stat->st_mtime_nsec;
1366 inode->i_ctime.tv_sec = stat->st_ctime_sec;
1367 inode->i_ctime.tv_nsec = stat->st_ctime_nsec;
1368 inode->i_uid = stat->st_uid;
1369 inode->i_gid = stat->st_gid;
1370 inode->i_nlink = stat->st_nlink;
1371 inode->i_mode = stat->st_mode;
1372 inode->i_rdev = new_decode_dev(stat->st_rdev);
1373
1374 if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode)))
1375 init_special_inode(inode, inode->i_mode, inode->i_rdev);
1376
1377 i_size_write(inode, stat->st_size);
1378 inode->i_blocks = stat->st_blocks;
1379 } else {
1380 if (stat->st_result_mask & P9_STATS_ATIME) {
1381 inode->i_atime.tv_sec = stat->st_atime_sec;
1382 inode->i_atime.tv_nsec = stat->st_atime_nsec;
1383 }
1384 if (stat->st_result_mask & P9_STATS_MTIME) {
1385 inode->i_mtime.tv_sec = stat->st_mtime_sec;
1386 inode->i_mtime.tv_nsec = stat->st_mtime_nsec;
1387 }
1388 if (stat->st_result_mask & P9_STATS_CTIME) {
1389 inode->i_ctime.tv_sec = stat->st_ctime_sec;
1390 inode->i_ctime.tv_nsec = stat->st_ctime_nsec;
1391 }
1392 if (stat->st_result_mask & P9_STATS_UID)
1393 inode->i_uid = stat->st_uid;
1394 if (stat->st_result_mask & P9_STATS_GID)
1395 inode->i_gid = stat->st_gid;
1396 if (stat->st_result_mask & P9_STATS_NLINK)
1397 inode->i_nlink = stat->st_nlink;
1398 if (stat->st_result_mask & P9_STATS_MODE) {
1399 inode->i_mode = stat->st_mode;
1400 if ((S_ISBLK(inode->i_mode)) ||
1401 (S_ISCHR(inode->i_mode)))
1402 init_special_inode(inode, inode->i_mode,
1403 inode->i_rdev);
1404 }
1405 if (stat->st_result_mask & P9_STATS_RDEV)
1406 inode->i_rdev = new_decode_dev(stat->st_rdev);
1407 if (stat->st_result_mask & P9_STATS_SIZE)
1408 i_size_write(inode, stat->st_size);
1409 if (stat->st_result_mask & P9_STATS_BLOCKS)
1410 inode->i_blocks = stat->st_blocks;
1411 }
1412 if (stat->st_result_mask & P9_STATS_GEN)
1413 inode->i_generation = stat->st_gen;
1414
1415 /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION
1416 * because the inode structure does not have fields for them.
1417 */
1418}
1419
1420/**
963 * v9fs_qid2ino - convert qid into inode number 1421 * v9fs_qid2ino - convert qid into inode number
964 * @qid: qid to hash 1422 * @qid: qid to hash
965 * 1423 *
@@ -1002,7 +1460,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
1002 if (IS_ERR(fid)) 1460 if (IS_ERR(fid))
1003 return PTR_ERR(fid); 1461 return PTR_ERR(fid);
1004 1462
1005 if (!v9fs_proto_dotu(v9ses)) 1463 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses))
1006 return -EBADF; 1464 return -EBADF;
1007 1465
1008 st = p9_client_stat(fid); 1466 st = p9_client_stat(fid);
@@ -1108,6 +1566,99 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1108} 1566}
1109 1567
1110/** 1568/**
1569 * v9fs_vfs_symlink_dotl - helper function to create symlinks
1570 * @dir: directory inode containing symlink
1571 * @dentry: dentry for symlink
1572 * @symname: symlink data
1573 *
1574 * See Also: 9P2000.L RFC for more information
1575 *
1576 */
1577
1578static int
1579v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
1580 const char *symname)
1581{
1582 struct v9fs_session_info *v9ses;
1583 struct p9_fid *dfid;
1584 struct p9_fid *fid = NULL;
1585 struct inode *inode;
1586 struct p9_qid qid;
1587 char *name;
1588 int err;
1589 gid_t gid;
1590
1591 name = (char *) dentry->d_name.name;
1592 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
1593 dir->i_ino, name, symname);
1594 v9ses = v9fs_inode2v9ses(dir);
1595
1596 dfid = v9fs_fid_lookup(dentry->d_parent);
1597 if (IS_ERR(dfid)) {
1598 err = PTR_ERR(dfid);
1599 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
1600 return err;
1601 }
1602
1603 gid = v9fs_get_fsgid_for_create(dir);
1604
1605 if (gid < 0) {
1606 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_get_egid failed %d\n", gid);
1607 goto error;
1608 }
1609
1610 /* Server doesn't alter fid on TSYMLINK. Hence no need to clone it. */
1611 err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid);
1612
1613 if (err < 0) {
1614 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
1615 goto error;
1616 }
1617
1618 if (v9ses->cache) {
1619 /* Now walk from the parent so we can get an unopened fid. */
1620 fid = p9_client_walk(dfid, 1, &name, 1);
1621 if (IS_ERR(fid)) {
1622 err = PTR_ERR(fid);
1623 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
1624 err);
1625 fid = NULL;
1626 goto error;
1627 }
1628
1629 /* instantiate inode and assign the unopened fid to dentry */
1630 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
1631 if (IS_ERR(inode)) {
1632 err = PTR_ERR(inode);
1633 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
1634 err);
1635 goto error;
1636 }
1637 dentry->d_op = &v9fs_cached_dentry_operations;
1638 d_instantiate(dentry, inode);
1639 err = v9fs_fid_add(dentry, fid);
1640 if (err < 0)
1641 goto error;
1642 fid = NULL;
1643 } else {
1644 /* Not in cached mode. No need to populate inode with stat */
1645 inode = v9fs_get_inode(dir->i_sb, S_IFLNK);
1646 if (IS_ERR(inode)) {
1647 err = PTR_ERR(inode);
1648 goto error;
1649 }
1650 dentry->d_op = &v9fs_dentry_operations;
1651 d_instantiate(dentry, inode);
1652 }
1653
1654error:
1655 if (fid)
1656 p9_client_clunk(fid);
1657
1658 return err;
1659}
1660
1661/**
1111 * v9fs_vfs_symlink - helper function to create symlinks 1662 * v9fs_vfs_symlink - helper function to create symlinks
1112 * @dir: directory inode containing symlink 1663 * @dir: directory inode containing symlink
1113 * @dentry: dentry for symlink 1664 * @dentry: dentry for symlink
@@ -1166,6 +1717,76 @@ clunk_fid:
1166} 1717}
1167 1718
1168/** 1719/**
1720 * v9fs_vfs_link_dotl - create a hardlink for dotl
1721 * @old_dentry: dentry for file to link to
1722 * @dir: inode destination for new link
1723 * @dentry: dentry for link
1724 *
1725 */
1726
1727static int
1728v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
1729 struct dentry *dentry)
1730{
1731 int err;
1732 struct p9_fid *dfid, *oldfid;
1733 char *name;
1734 struct v9fs_session_info *v9ses;
1735 struct dentry *dir_dentry;
1736
1737 P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
1738 dir->i_ino, old_dentry->d_name.name,
1739 dentry->d_name.name);
1740
1741 v9ses = v9fs_inode2v9ses(dir);
1742 dir_dentry = v9fs_dentry_from_dir_inode(dir);
1743 dfid = v9fs_fid_lookup(dir_dentry);
1744 if (IS_ERR(dfid))
1745 return PTR_ERR(dfid);
1746
1747 oldfid = v9fs_fid_lookup(old_dentry);
1748 if (IS_ERR(oldfid))
1749 return PTR_ERR(oldfid);
1750
1751 name = (char *) dentry->d_name.name;
1752
1753 err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
1754
1755 if (err < 0) {
1756 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
1757 return err;
1758 }
1759
1760 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
1761 /* Get the latest stat info from server. */
1762 struct p9_fid *fid;
1763 struct p9_stat_dotl *st;
1764
1765 fid = v9fs_fid_lookup(old_dentry);
1766 if (IS_ERR(fid))
1767 return PTR_ERR(fid);
1768
1769 st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
1770 if (IS_ERR(st))
1771 return PTR_ERR(st);
1772
1773 v9fs_stat2inode_dotl(st, old_dentry->d_inode);
1774
1775 kfree(st);
1776 } else {
1777 /* Caching disabled. No need to get upto date stat info.
1778 * This dentry will be released immediately. So, just i_count++
1779 */
1780 atomic_inc(&old_dentry->d_inode->i_count);
1781 }
1782
1783 dentry->d_op = old_dentry->d_op;
1784 d_instantiate(dentry, old_dentry->d_inode);
1785
1786 return err;
1787}
1788
1789/**
1169 * v9fs_vfs_mknod - create a special file 1790 * v9fs_vfs_mknod - create a special file
1170 * @dir: inode destination for new link 1791 * @dir: inode destination for new link
1171 * @dentry: dentry for file 1792 * @dentry: dentry for file
@@ -1197,6 +1818,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1197 sprintf(name, "c %u %u", MAJOR(rdev), MINOR(rdev)); 1818 sprintf(name, "c %u %u", MAJOR(rdev), MINOR(rdev));
1198 else if (S_ISFIFO(mode)) 1819 else if (S_ISFIFO(mode))
1199 *name = 0; 1820 *name = 0;
1821 else if (S_ISSOCK(mode))
1822 *name = 0;
1200 else { 1823 else {
1201 __putname(name); 1824 __putname(name);
1202 return -EINVAL; 1825 return -EINVAL;
@@ -1208,7 +1831,101 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1208 return retval; 1831 return retval;
1209} 1832}
1210 1833
1211static const struct inode_operations v9fs_dir_inode_operations_ext = { 1834/**
1835 * v9fs_vfs_mknod_dotl - create a special file
1836 * @dir: inode destination for new link
1837 * @dentry: dentry for file
1838 * @mode: mode for creation
1839 * @rdev: device associated with special file
1840 *
1841 */
1842static int
1843v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int mode,
1844 dev_t rdev)
1845{
1846 int err;
1847 char *name;
1848 struct v9fs_session_info *v9ses;
1849 struct p9_fid *fid = NULL, *dfid = NULL;
1850 struct inode *inode;
1851 gid_t gid;
1852 struct p9_qid qid;
1853 struct dentry *dir_dentry;
1854
1855 P9_DPRINTK(P9_DEBUG_VFS,
1856 " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
1857 dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
1858
1859 if (!new_valid_dev(rdev))
1860 return -EINVAL;
1861
1862 v9ses = v9fs_inode2v9ses(dir);
1863 dir_dentry = v9fs_dentry_from_dir_inode(dir);
1864 dfid = v9fs_fid_lookup(dir_dentry);
1865 if (IS_ERR(dfid)) {
1866 err = PTR_ERR(dfid);
1867 P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
1868 dfid = NULL;
1869 goto error;
1870 }
1871
1872 gid = v9fs_get_fsgid_for_create(dir);
1873 if (gid < 0) {
1874 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_get_fsgid_for_create failed\n");
1875 goto error;
1876 }
1877
1878 name = (char *) dentry->d_name.name;
1879
1880 err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid);
1881 if (err < 0)
1882 goto error;
1883
1884 /* instantiate inode and assign the unopened fid to the dentry */
1885 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
1886 fid = p9_client_walk(dfid, 1, &name, 1);
1887 if (IS_ERR(fid)) {
1888 err = PTR_ERR(fid);
1889 P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
1890 err);
1891 fid = NULL;
1892 goto error;
1893 }
1894
1895 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
1896 if (IS_ERR(inode)) {
1897 err = PTR_ERR(inode);
1898 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
1899 err);
1900 goto error;
1901 }
1902 dentry->d_op = &v9fs_cached_dentry_operations;
1903 d_instantiate(dentry, inode);
1904 err = v9fs_fid_add(dentry, fid);
1905 if (err < 0)
1906 goto error;
1907 fid = NULL;
1908 } else {
1909 /*
1910 * Not in cached mode. No need to populate inode with stat.
1911 * socket syscall returns a fd, so we need instantiate
1912 */
1913 inode = v9fs_get_inode(dir->i_sb, mode);
1914 if (IS_ERR(inode)) {
1915 err = PTR_ERR(inode);
1916 goto error;
1917 }
1918 dentry->d_op = &v9fs_dentry_operations;
1919 d_instantiate(dentry, inode);
1920 }
1921
1922error:
1923 if (fid)
1924 p9_client_clunk(fid);
1925 return err;
1926}
1927
1928static const struct inode_operations v9fs_dir_inode_operations_dotu = {
1212 .create = v9fs_vfs_create, 1929 .create = v9fs_vfs_create,
1213 .lookup = v9fs_vfs_lookup, 1930 .lookup = v9fs_vfs_lookup,
1214 .symlink = v9fs_vfs_symlink, 1931 .symlink = v9fs_vfs_symlink,
@@ -1216,12 +1933,31 @@ static const struct inode_operations v9fs_dir_inode_operations_ext = {
1216 .unlink = v9fs_vfs_unlink, 1933 .unlink = v9fs_vfs_unlink,
1217 .mkdir = v9fs_vfs_mkdir, 1934 .mkdir = v9fs_vfs_mkdir,
1218 .rmdir = v9fs_vfs_rmdir, 1935 .rmdir = v9fs_vfs_rmdir,
1219 .mknod = v9fs_vfs_mknod, 1936 .mknod = v9fs_vfs_mknod_dotl,
1220 .rename = v9fs_vfs_rename, 1937 .rename = v9fs_vfs_rename,
1221 .getattr = v9fs_vfs_getattr, 1938 .getattr = v9fs_vfs_getattr,
1222 .setattr = v9fs_vfs_setattr, 1939 .setattr = v9fs_vfs_setattr,
1223}; 1940};
1224 1941
1942static const struct inode_operations v9fs_dir_inode_operations_dotl = {
1943 .create = v9fs_vfs_create_dotl,
1944 .lookup = v9fs_vfs_lookup,
1945 .link = v9fs_vfs_link_dotl,
1946 .symlink = v9fs_vfs_symlink_dotl,
1947 .unlink = v9fs_vfs_unlink,
1948 .mkdir = v9fs_vfs_mkdir_dotl,
1949 .rmdir = v9fs_vfs_rmdir,
1950 .mknod = v9fs_vfs_mknod_dotl,
1951 .rename = v9fs_vfs_rename,
1952 .getattr = v9fs_vfs_getattr_dotl,
1953 .setattr = v9fs_vfs_setattr_dotl,
1954 .setxattr = generic_setxattr,
1955 .getxattr = generic_getxattr,
1956 .removexattr = generic_removexattr,
1957 .listxattr = v9fs_listxattr,
1958
1959};
1960
1225static const struct inode_operations v9fs_dir_inode_operations = { 1961static const struct inode_operations v9fs_dir_inode_operations = {
1226 .create = v9fs_vfs_create, 1962 .create = v9fs_vfs_create,
1227 .lookup = v9fs_vfs_lookup, 1963 .lookup = v9fs_vfs_lookup,
@@ -1239,6 +1975,15 @@ static const struct inode_operations v9fs_file_inode_operations = {
1239 .setattr = v9fs_vfs_setattr, 1975 .setattr = v9fs_vfs_setattr,
1240}; 1976};
1241 1977
1978static const struct inode_operations v9fs_file_inode_operations_dotl = {
1979 .getattr = v9fs_vfs_getattr_dotl,
1980 .setattr = v9fs_vfs_setattr_dotl,
1981 .setxattr = generic_setxattr,
1982 .getxattr = generic_getxattr,
1983 .removexattr = generic_removexattr,
1984 .listxattr = v9fs_listxattr,
1985};
1986
1242static const struct inode_operations v9fs_symlink_inode_operations = { 1987static const struct inode_operations v9fs_symlink_inode_operations = {
1243 .readlink = generic_readlink, 1988 .readlink = generic_readlink,
1244 .follow_link = v9fs_vfs_follow_link, 1989 .follow_link = v9fs_vfs_follow_link,
@@ -1246,3 +1991,15 @@ static const struct inode_operations v9fs_symlink_inode_operations = {
1246 .getattr = v9fs_vfs_getattr, 1991 .getattr = v9fs_vfs_getattr,
1247 .setattr = v9fs_vfs_setattr, 1992 .setattr = v9fs_vfs_setattr,
1248}; 1993};
1994
1995static const struct inode_operations v9fs_symlink_inode_operations_dotl = {
1996 .readlink = generic_readlink,
1997 .follow_link = v9fs_vfs_follow_link,
1998 .put_link = v9fs_vfs_put_link,
1999 .getattr = v9fs_vfs_getattr_dotl,
2000 .setattr = v9fs_vfs_setattr_dotl,
2001 .setxattr = generic_setxattr,
2002 .getxattr = generic_getxattr,
2003 .removexattr = generic_removexattr,
2004 .listxattr = v9fs_listxattr,
2005};