1 // SPDX-License-Identifier: GPL-2.0-only
3 * This file contains vfs inode ops for the 9P2000.L protocol.
5 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
6 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
9 #include <linux/module.h>
10 #include <linux/errno.h>
12 #include <linux/file.h>
13 #include <linux/pagemap.h>
14 #include <linux/stat.h>
15 #include <linux/string.h>
16 #include <linux/namei.h>
17 #include <linux/sched.h>
18 #include <linux/slab.h>
19 #include <linux/xattr.h>
20 #include <linux/posix_acl.h>
21 #include <net/9p/9p.h>
22 #include <net/9p/client.h>
32 v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
33 struct dentry *dentry, umode_t omode, dev_t rdev);
36 * v9fs_get_fsgid_for_create - Helper function to get the gid for a new object
37 * @dir_inode: The directory inode
39 * Helper function to get the gid for creating a
40 * new file system object. This checks the S_ISGID to determine the owning
41 * group of the new file system object.
44 static kgid_t v9fs_get_fsgid_for_create(struct inode *dir_inode)
46 BUG_ON(dir_inode == NULL);
48 if (dir_inode->i_mode & S_ISGID) {
49 /* set_gid bit is set.*/
50 return dir_inode->i_gid;
52 return current_fsgid();
55 struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid)
59 struct p9_stat_dotl *st;
60 struct v9fs_session_info *v9ses = sb->s_fs_info;
62 inode = iget_locked(sb, QID2INO(&fid->qid));
64 return ERR_PTR(-ENOMEM);
65 if (!(inode->i_state & I_NEW))
69 * initialize the inode with the stat info
70 * FIXME!! we may need support for stale inodes
73 st = p9_client_getattr_dotl(fid, P9_STATS_BASIC | P9_STATS_GEN);
79 retval = v9fs_init_inode(v9ses, inode, &fid->qid,
80 st->st_mode, new_decode_dev(st->st_rdev));
85 v9fs_stat2inode_dotl(st, inode, 0);
86 v9fs_set_netfs_context(inode);
87 v9fs_cache_inode_get_cookie(inode);
88 retval = v9fs_get_acl(inode, fid);
92 unlock_new_inode(inode);
97 return ERR_PTR(retval);
101 struct dotl_openflag_map {
106 static int v9fs_mapped_dotl_flags(int flags)
110 struct dotl_openflag_map dotl_oflag_map[] = {
111 { O_CREAT, P9_DOTL_CREATE },
112 { O_EXCL, P9_DOTL_EXCL },
113 { O_NOCTTY, P9_DOTL_NOCTTY },
114 { O_APPEND, P9_DOTL_APPEND },
115 { O_NONBLOCK, P9_DOTL_NONBLOCK },
116 { O_DSYNC, P9_DOTL_DSYNC },
117 { FASYNC, P9_DOTL_FASYNC },
118 { O_DIRECT, P9_DOTL_DIRECT },
119 { O_LARGEFILE, P9_DOTL_LARGEFILE },
120 { O_DIRECTORY, P9_DOTL_DIRECTORY },
121 { O_NOFOLLOW, P9_DOTL_NOFOLLOW },
122 { O_NOATIME, P9_DOTL_NOATIME },
123 { O_CLOEXEC, P9_DOTL_CLOEXEC },
124 { O_SYNC, P9_DOTL_SYNC},
126 for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) {
127 if (flags & dotl_oflag_map[i].open_flag)
128 rflags |= dotl_oflag_map[i].dotl_flag;
134 * v9fs_open_to_dotl_flags- convert Linux specific open flags to
136 * @flags: flags to convert
138 int v9fs_open_to_dotl_flags(int flags)
143 * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY
144 * and P9_DOTL_NOACCESS
146 rflags |= flags & O_ACCMODE;
147 rflags |= v9fs_mapped_dotl_flags(flags);
153 * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol.
154 * @idmap: The user namespace of the mount
155 * @dir: directory inode that is being created
156 * @dentry: dentry that is being deleted
157 * @omode: create permissions
158 * @excl: True if the file must not yet exist
162 v9fs_vfs_create_dotl(struct mnt_idmap *idmap, struct inode *dir,
163 struct dentry *dentry, umode_t omode, bool excl)
165 return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0);
169 v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
170 struct file *file, unsigned int flags, umode_t omode)
175 int p9_omode = v9fs_open_to_dotl_flags(flags);
176 const unsigned char *name = NULL;
179 struct p9_fid *fid = NULL;
180 struct p9_fid *dfid = NULL, *ofid = NULL;
181 struct v9fs_session_info *v9ses;
182 struct posix_acl *pacl = NULL, *dacl = NULL;
183 struct dentry *res = NULL;
185 if (d_in_lookup(dentry)) {
186 res = v9fs_vfs_lookup(dir, dentry, 0);
195 if (!(flags & O_CREAT) || d_really_is_positive(dentry))
196 return finish_no_open(file, res);
198 v9ses = v9fs_inode2v9ses(dir);
200 name = dentry->d_name.name;
201 p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
204 dfid = v9fs_parent_fid(dentry);
207 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
211 /* clone a fid to use for creation */
212 ofid = clone_fid(dfid);
215 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
219 gid = v9fs_get_fsgid_for_create(dir);
222 /* Update mode based on ACL value */
223 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
225 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in create %d\n",
230 if ((v9ses->cache & CACHE_WRITEBACK) && (p9_omode & P9_OWRITE)) {
231 p9_omode = (p9_omode & ~P9_OWRITE) | P9_ORDWR;
232 p9_debug(P9_DEBUG_CACHE,
233 "write-only file with writeback enabled, creating w/ O_RDWR\n");
235 err = p9_client_create_dotl(ofid, name, p9_omode, mode, gid, &qid);
237 p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in create %d\n",
241 v9fs_invalidate_inode_attr(dir);
243 /* instantiate inode and assign the unopened fid to the dentry */
244 fid = p9_client_walk(dfid, 1, &name, 1);
247 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
250 inode = v9fs_fid_iget_dotl(dir->i_sb, fid);
252 err = PTR_ERR(inode);
253 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
256 /* Now set the ACL based on the default value */
257 v9fs_set_create_acl(inode, fid, dacl, pacl);
259 v9fs_fid_add(dentry, &fid);
260 d_instantiate(dentry, inode);
262 /* Since we are opening a file, assign the open fid to the file */
263 err = finish_open(file, dentry, generic_file_open);
266 file->private_data = ofid;
267 #ifdef CONFIG_9P_FSCACHE
268 if (v9ses->cache & CACHE_FSCACHE) {
269 struct v9fs_inode *v9inode = V9FS_I(inode);
270 fscache_use_cookie(v9fs_inode_cookie(v9inode),
271 file->f_mode & FMODE_WRITE);
274 v9fs_fid_add_modes(ofid, v9ses->flags, v9ses->cache, flags);
275 v9fs_open_fid_add(inode, &ofid);
276 file->f_mode |= FMODE_CREATED;
281 v9fs_put_acl(dacl, pacl);
287 * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory
288 * @idmap: The idmap of the mount
289 * @dir: inode that is being unlinked
290 * @dentry: dentry that is being unlinked
291 * @omode: mode for new directory
295 static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
296 struct inode *dir, struct dentry *dentry,
300 struct v9fs_session_info *v9ses;
301 struct p9_fid *fid = NULL, *dfid = NULL;
303 const unsigned char *name;
307 struct posix_acl *dacl = NULL, *pacl = NULL;
309 p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry);
310 v9ses = v9fs_inode2v9ses(dir);
313 if (dir->i_mode & S_ISGID)
316 dfid = v9fs_parent_fid(dentry);
319 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
323 gid = v9fs_get_fsgid_for_create(dir);
325 /* Update mode based on ACL value */
326 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
328 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n",
332 name = dentry->d_name.name;
333 err = p9_client_mkdir_dotl(dfid, name, mode, gid, &qid);
336 fid = p9_client_walk(dfid, 1, &name, 1);
339 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
344 /* instantiate inode and assign the unopened fid to the dentry */
345 inode = v9fs_fid_iget_dotl(dir->i_sb, fid);
347 err = PTR_ERR(inode);
348 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
352 v9fs_fid_add(dentry, &fid);
353 v9fs_set_create_acl(inode, fid, dacl, pacl);
354 d_instantiate(dentry, inode);
357 v9fs_invalidate_inode_attr(dir);
360 v9fs_put_acl(dacl, pacl);
366 v9fs_vfs_getattr_dotl(struct mnt_idmap *idmap,
367 const struct path *path, struct kstat *stat,
368 u32 request_mask, unsigned int flags)
370 struct dentry *dentry = path->dentry;
371 struct v9fs_session_info *v9ses;
373 struct inode *inode = d_inode(dentry);
374 struct p9_stat_dotl *st;
376 p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
377 v9ses = v9fs_dentry2v9ses(dentry);
378 if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
379 generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
381 } else if (v9ses->cache) {
382 if (S_ISREG(inode->i_mode)) {
383 int retval = filemap_fdatawrite(inode->i_mapping);
386 p9_debug(P9_DEBUG_ERROR,
387 "flushing writeback during getattr returned %d\n", retval);
390 fid = v9fs_fid_lookup(dentry);
394 /* Ask for all the fields in stat structure. Server will return
395 * whatever it supports
398 st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
403 v9fs_stat2inode_dotl(st, d_inode(dentry), 0);
404 generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat);
405 /* Change block size to what the server returned */
406 stat->blksize = st->st_blksize;
415 #define P9_ATTR_MODE (1 << 0)
416 #define P9_ATTR_UID (1 << 1)
417 #define P9_ATTR_GID (1 << 2)
418 #define P9_ATTR_SIZE (1 << 3)
419 #define P9_ATTR_ATIME (1 << 4)
420 #define P9_ATTR_MTIME (1 << 5)
421 #define P9_ATTR_CTIME (1 << 6)
422 #define P9_ATTR_ATIME_SET (1 << 7)
423 #define P9_ATTR_MTIME_SET (1 << 8)
425 struct dotl_iattr_map {
430 static int v9fs_mapped_iattr_valid(int iattr_valid)
433 int p9_iattr_valid = 0;
434 struct dotl_iattr_map dotl_iattr_map[] = {
435 { ATTR_MODE, P9_ATTR_MODE },
436 { ATTR_UID, P9_ATTR_UID },
437 { ATTR_GID, P9_ATTR_GID },
438 { ATTR_SIZE, P9_ATTR_SIZE },
439 { ATTR_ATIME, P9_ATTR_ATIME },
440 { ATTR_MTIME, P9_ATTR_MTIME },
441 { ATTR_CTIME, P9_ATTR_CTIME },
442 { ATTR_ATIME_SET, P9_ATTR_ATIME_SET },
443 { ATTR_MTIME_SET, P9_ATTR_MTIME_SET },
445 for (i = 0; i < ARRAY_SIZE(dotl_iattr_map); i++) {
446 if (iattr_valid & dotl_iattr_map[i].iattr_valid)
447 p9_iattr_valid |= dotl_iattr_map[i].p9_iattr_valid;
449 return p9_iattr_valid;
453 * v9fs_vfs_setattr_dotl - set file metadata
454 * @idmap: idmap of the mount
455 * @dentry: file whose metadata to set
456 * @iattr: metadata assignment structure
460 int v9fs_vfs_setattr_dotl(struct mnt_idmap *idmap,
461 struct dentry *dentry, struct iattr *iattr)
463 int retval, use_dentry = 0;
464 struct inode *inode = d_inode(dentry);
465 struct v9fs_session_info __maybe_unused *v9ses;
466 struct p9_fid *fid = NULL;
467 struct p9_iattr_dotl p9attr = {
472 p9_debug(P9_DEBUG_VFS, "\n");
474 retval = setattr_prepare(&nop_mnt_idmap, dentry, iattr);
478 v9ses = v9fs_dentry2v9ses(dentry);
480 p9attr.valid = v9fs_mapped_iattr_valid(iattr->ia_valid);
481 if (iattr->ia_valid & ATTR_MODE)
482 p9attr.mode = iattr->ia_mode;
483 if (iattr->ia_valid & ATTR_UID)
484 p9attr.uid = iattr->ia_uid;
485 if (iattr->ia_valid & ATTR_GID)
486 p9attr.gid = iattr->ia_gid;
487 if (iattr->ia_valid & ATTR_SIZE)
488 p9attr.size = iattr->ia_size;
489 if (iattr->ia_valid & ATTR_ATIME_SET) {
490 p9attr.atime_sec = iattr->ia_atime.tv_sec;
491 p9attr.atime_nsec = iattr->ia_atime.tv_nsec;
493 if (iattr->ia_valid & ATTR_MTIME_SET) {
494 p9attr.mtime_sec = iattr->ia_mtime.tv_sec;
495 p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec;
498 if (iattr->ia_valid & ATTR_FILE) {
499 fid = iattr->ia_file->private_data;
503 fid = v9fs_fid_lookup(dentry);
509 /* Write all dirty data */
510 if (S_ISREG(inode->i_mode)) {
511 retval = filemap_fdatawrite(inode->i_mapping);
513 p9_debug(P9_DEBUG_ERROR,
514 "Flushing file prior to setattr failed: %d\n", retval);
517 retval = p9_client_setattr(fid, &p9attr);
524 if ((iattr->ia_valid & ATTR_SIZE) && iattr->ia_size !=
525 i_size_read(inode)) {
526 truncate_setsize(inode, iattr->ia_size);
527 netfs_resize_file(netfs_inode(inode), iattr->ia_size, true);
529 #ifdef CONFIG_9P_FSCACHE
530 if (v9ses->cache & CACHE_FSCACHE)
531 fscache_resize_cookie(v9fs_inode_cookie(V9FS_I(inode)),
536 v9fs_invalidate_inode_attr(inode);
537 setattr_copy(&nop_mnt_idmap, inode, iattr);
538 mark_inode_dirty(inode);
539 if (iattr->ia_valid & ATTR_MODE) {
540 /* We also want to update ACL when we update mode bits */
541 retval = v9fs_acl_chmod(inode, fid);
555 * v9fs_stat2inode_dotl - populate an inode structure with stat info
556 * @stat: stat structure
557 * @inode: inode to populate
558 * @flags: ctrl flags (e.g. V9FS_STAT2INODE_KEEP_ISIZE)
563 v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
567 struct v9fs_inode *v9inode = V9FS_I(inode);
569 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) {
570 inode_set_atime(inode, stat->st_atime_sec,
571 stat->st_atime_nsec);
572 inode_set_mtime(inode, stat->st_mtime_sec,
573 stat->st_mtime_nsec);
574 inode_set_ctime(inode, stat->st_ctime_sec,
575 stat->st_ctime_nsec);
576 inode->i_uid = stat->st_uid;
577 inode->i_gid = stat->st_gid;
578 set_nlink(inode, stat->st_nlink);
580 mode = stat->st_mode & S_IALLUGO;
581 mode |= inode->i_mode & ~S_IALLUGO;
582 inode->i_mode = mode;
584 v9inode->netfs.remote_i_size = stat->st_size;
585 if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
586 v9fs_i_size_write(inode, stat->st_size);
587 inode->i_blocks = stat->st_blocks;
589 if (stat->st_result_mask & P9_STATS_ATIME) {
590 inode_set_atime(inode, stat->st_atime_sec,
591 stat->st_atime_nsec);
593 if (stat->st_result_mask & P9_STATS_MTIME) {
594 inode_set_mtime(inode, stat->st_mtime_sec,
595 stat->st_mtime_nsec);
597 if (stat->st_result_mask & P9_STATS_CTIME) {
598 inode_set_ctime(inode, stat->st_ctime_sec,
599 stat->st_ctime_nsec);
601 if (stat->st_result_mask & P9_STATS_UID)
602 inode->i_uid = stat->st_uid;
603 if (stat->st_result_mask & P9_STATS_GID)
604 inode->i_gid = stat->st_gid;
605 if (stat->st_result_mask & P9_STATS_NLINK)
606 set_nlink(inode, stat->st_nlink);
607 if (stat->st_result_mask & P9_STATS_MODE) {
608 mode = stat->st_mode & S_IALLUGO;
609 mode |= inode->i_mode & ~S_IALLUGO;
610 inode->i_mode = mode;
612 if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) &&
613 stat->st_result_mask & P9_STATS_SIZE) {
614 v9inode->netfs.remote_i_size = stat->st_size;
615 v9fs_i_size_write(inode, stat->st_size);
617 if (stat->st_result_mask & P9_STATS_BLOCKS)
618 inode->i_blocks = stat->st_blocks;
620 if (stat->st_result_mask & P9_STATS_GEN)
621 inode->i_generation = stat->st_gen;
623 /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION
624 * because the inode structure does not have fields for them.
626 v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
630 v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir,
631 struct dentry *dentry, const char *symname)
635 const unsigned char *name;
638 struct p9_fid *fid = NULL;
640 name = dentry->d_name.name;
641 p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
643 dfid = v9fs_parent_fid(dentry);
646 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
650 gid = v9fs_get_fsgid_for_create(dir);
652 /* Server doesn't alter fid on TSYMLINK. Hence no need to clone it. */
653 err = p9_client_symlink(dfid, name, symname, gid, &qid);
656 p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
660 v9fs_invalidate_inode_attr(dir);
669 * v9fs_vfs_link_dotl - create a hardlink for dotl
670 * @old_dentry: dentry for file to link to
671 * @dir: inode destination for new link
672 * @dentry: dentry for link
677 v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
678 struct dentry *dentry)
681 struct p9_fid *dfid, *oldfid;
682 struct v9fs_session_info *v9ses;
684 p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %pd, new_name: %pd\n",
685 dir->i_ino, old_dentry, dentry);
687 v9ses = v9fs_inode2v9ses(dir);
688 dfid = v9fs_parent_fid(dentry);
690 return PTR_ERR(dfid);
692 oldfid = v9fs_fid_lookup(old_dentry);
693 if (IS_ERR(oldfid)) {
695 return PTR_ERR(oldfid);
698 err = p9_client_link(dfid, oldfid, dentry->d_name.name);
703 p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
707 v9fs_invalidate_inode_attr(dir);
708 if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
709 /* Get the latest stat info from server. */
712 fid = v9fs_fid_lookup(old_dentry);
716 v9fs_refresh_inode_dotl(fid, d_inode(old_dentry));
719 ihold(d_inode(old_dentry));
720 d_instantiate(dentry, d_inode(old_dentry));
726 * v9fs_vfs_mknod_dotl - create a special file
727 * @idmap: The idmap of the mount
728 * @dir: inode destination for new link
729 * @dentry: dentry for file
730 * @omode: mode for creation
731 * @rdev: device associated with special file
735 v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
736 struct dentry *dentry, umode_t omode, dev_t rdev)
740 const unsigned char *name;
742 struct v9fs_session_info *v9ses;
743 struct p9_fid *fid = NULL, *dfid = NULL;
746 struct posix_acl *dacl = NULL, *pacl = NULL;
748 p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %x MAJOR: %u MINOR: %u\n",
749 dir->i_ino, dentry, omode,
750 MAJOR(rdev), MINOR(rdev));
752 v9ses = v9fs_inode2v9ses(dir);
753 dfid = v9fs_parent_fid(dentry);
756 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
760 gid = v9fs_get_fsgid_for_create(dir);
762 /* Update mode based on ACL value */
763 err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
765 p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
769 name = dentry->d_name.name;
771 err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid);
775 v9fs_invalidate_inode_attr(dir);
776 fid = p9_client_walk(dfid, 1, &name, 1);
779 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
783 inode = v9fs_fid_iget_dotl(dir->i_sb, fid);
785 err = PTR_ERR(inode);
786 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
790 v9fs_set_create_acl(inode, fid, dacl, pacl);
791 v9fs_fid_add(dentry, &fid);
792 d_instantiate(dentry, inode);
796 v9fs_put_acl(dacl, pacl);
803 * v9fs_vfs_get_link_dotl - follow a symlink path
804 * @dentry: dentry for symlink
805 * @inode: inode for symlink
806 * @done: destructor for return value
810 v9fs_vfs_get_link_dotl(struct dentry *dentry,
812 struct delayed_call *done)
819 return ERR_PTR(-ECHILD);
821 p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
823 fid = v9fs_fid_lookup(dentry);
825 return ERR_CAST(fid);
826 retval = p9_client_readlink(fid, &target);
829 return ERR_PTR(retval);
830 set_delayed_call(done, kfree_link, target);
834 int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
836 struct p9_stat_dotl *st;
837 struct v9fs_session_info *v9ses;
840 v9ses = v9fs_inode2v9ses(inode);
841 st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
845 * Don't update inode if the file type is different
847 if (inode_wrong_type(inode, st->st_mode))
851 * We don't want to refresh inode->i_size,
852 * because we may have cached data
854 flags = (v9ses->cache & CACHE_LOOSE) ?
855 V9FS_STAT2INODE_KEEP_ISIZE : 0;
856 v9fs_stat2inode_dotl(st, inode, flags);
862 const struct inode_operations v9fs_dir_inode_operations_dotl = {
863 .create = v9fs_vfs_create_dotl,
864 .atomic_open = v9fs_vfs_atomic_open_dotl,
865 .lookup = v9fs_vfs_lookup,
866 .link = v9fs_vfs_link_dotl,
867 .symlink = v9fs_vfs_symlink_dotl,
868 .unlink = v9fs_vfs_unlink,
869 .mkdir = v9fs_vfs_mkdir_dotl,
870 .rmdir = v9fs_vfs_rmdir,
871 .mknod = v9fs_vfs_mknod_dotl,
872 .rename = v9fs_vfs_rename,
873 .getattr = v9fs_vfs_getattr_dotl,
874 .setattr = v9fs_vfs_setattr_dotl,
875 .listxattr = v9fs_listxattr,
876 .get_inode_acl = v9fs_iop_get_inode_acl,
877 .get_acl = v9fs_iop_get_acl,
878 .set_acl = v9fs_iop_set_acl,
881 const struct inode_operations v9fs_file_inode_operations_dotl = {
882 .getattr = v9fs_vfs_getattr_dotl,
883 .setattr = v9fs_vfs_setattr_dotl,
884 .listxattr = v9fs_listxattr,
885 .get_inode_acl = v9fs_iop_get_inode_acl,
886 .get_acl = v9fs_iop_get_acl,
887 .set_acl = v9fs_iop_set_acl,
890 const struct inode_operations v9fs_symlink_inode_operations_dotl = {
891 .get_link = v9fs_vfs_get_link_dotl,
892 .getattr = v9fs_vfs_getattr_dotl,
893 .setattr = v9fs_vfs_setattr_dotl,
894 .listxattr = v9fs_listxattr,