Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/9p/vfs_inode_dotl.c |
| 3 | * |
| 4 | * This file contains vfs inode ops for the 9P2000.L protocol. |
| 5 | * |
| 6 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
| 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 |
| 11 | * as published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to: |
| 20 | * Free Software Foundation |
| 21 | * 51 Franklin Street, Fifth Floor |
| 22 | * Boston, MA 02111-1301 USA |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/errno.h> |
| 28 | #include <linux/fs.h> |
| 29 | #include <linux/file.h> |
| 30 | #include <linux/pagemap.h> |
| 31 | #include <linux/stat.h> |
| 32 | #include <linux/string.h> |
| 33 | #include <linux/inet.h> |
| 34 | #include <linux/namei.h> |
| 35 | #include <linux/idr.h> |
| 36 | #include <linux/sched.h> |
| 37 | #include <linux/slab.h> |
| 38 | #include <linux/xattr.h> |
| 39 | #include <linux/posix_acl.h> |
| 40 | #include <net/9p/9p.h> |
| 41 | #include <net/9p/client.h> |
| 42 | |
| 43 | #include "v9fs.h" |
| 44 | #include "v9fs_vfs.h" |
| 45 | #include "fid.h" |
| 46 | #include "cache.h" |
| 47 | #include "xattr.h" |
| 48 | #include "acl.h" |
| 49 | |
| 50 | static int |
Al Viro | 1a67aaf | 2011-07-26 01:52:52 -0400 | [diff] [blame] | 51 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 52 | dev_t rdev); |
| 53 | |
| 54 | /** |
| 55 | * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a |
| 56 | * new file system object. This checks the S_ISGID to determine the owning |
| 57 | * group of the new file system object. |
| 58 | */ |
| 59 | |
| 60 | static gid_t v9fs_get_fsgid_for_create(struct inode *dir_inode) |
| 61 | { |
| 62 | BUG_ON(dir_inode == NULL); |
| 63 | |
| 64 | if (dir_inode->i_mode & S_ISGID) { |
| 65 | /* set_gid bit is set.*/ |
| 66 | return dir_inode->i_gid; |
| 67 | } |
| 68 | return current_fsgid(); |
| 69 | } |
| 70 | |
Aneesh Kumar K.V | fd2421f | 2011-07-11 16:40:59 +0000 | [diff] [blame] | 71 | static int v9fs_test_inode_dotl(struct inode *inode, void *data) |
| 72 | { |
| 73 | struct v9fs_inode *v9inode = V9FS_I(inode); |
| 74 | struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; |
| 75 | |
| 76 | /* don't match inode of different type */ |
| 77 | if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) |
| 78 | return 0; |
| 79 | |
| 80 | if (inode->i_generation != st->st_gen) |
| 81 | return 0; |
| 82 | |
| 83 | /* compare qid details */ |
| 84 | if (memcmp(&v9inode->qid.version, |
| 85 | &st->qid.version, sizeof(v9inode->qid.version))) |
| 86 | return 0; |
| 87 | |
| 88 | if (v9inode->qid.type != st->qid.type) |
| 89 | return 0; |
| 90 | return 1; |
| 91 | } |
| 92 | |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 93 | /* Always get a new inode */ |
| 94 | static int v9fs_test_new_inode_dotl(struct inode *inode, void *data) |
| 95 | { |
| 96 | return 0; |
| 97 | } |
| 98 | |
Aneesh Kumar K.V | fd2421f | 2011-07-11 16:40:59 +0000 | [diff] [blame] | 99 | static int v9fs_set_inode_dotl(struct inode *inode, void *data) |
| 100 | { |
| 101 | struct v9fs_inode *v9inode = V9FS_I(inode); |
| 102 | struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; |
| 103 | |
| 104 | memcpy(&v9inode->qid, &st->qid, sizeof(st->qid)); |
| 105 | inode->i_generation = st->st_gen; |
| 106 | return 0; |
| 107 | } |
| 108 | |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 109 | static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, |
| 110 | struct p9_qid *qid, |
| 111 | struct p9_fid *fid, |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 112 | struct p9_stat_dotl *st, |
| 113 | int new) |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 114 | { |
| 115 | int retval; |
| 116 | unsigned long i_ino; |
| 117 | struct inode *inode; |
| 118 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 119 | int (*test)(struct inode *, void *); |
| 120 | |
| 121 | if (new) |
| 122 | test = v9fs_test_new_inode_dotl; |
| 123 | else |
| 124 | test = v9fs_test_inode_dotl; |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 125 | |
| 126 | i_ino = v9fs_qid2ino(qid); |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 127 | inode = iget5_locked(sb, i_ino, test, v9fs_set_inode_dotl, st); |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 128 | if (!inode) |
| 129 | return ERR_PTR(-ENOMEM); |
| 130 | if (!(inode->i_state & I_NEW)) |
| 131 | return inode; |
| 132 | /* |
| 133 | * initialize the inode with the stat info |
| 134 | * FIXME!! we may need support for stale inodes |
| 135 | * later. |
| 136 | */ |
Aneesh Kumar K.V | fd2421f | 2011-07-11 16:40:59 +0000 | [diff] [blame] | 137 | inode->i_ino = i_ino; |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 138 | retval = v9fs_init_inode(v9ses, inode, |
| 139 | st->st_mode, new_decode_dev(st->st_rdev)); |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 140 | if (retval) |
| 141 | goto error; |
| 142 | |
| 143 | v9fs_stat2inode_dotl(st, inode); |
| 144 | #ifdef CONFIG_9P_FSCACHE |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 145 | v9fs_cache_inode_get_cookie(inode); |
| 146 | #endif |
| 147 | retval = v9fs_get_acl(inode, fid); |
| 148 | if (retval) |
| 149 | goto error; |
| 150 | |
| 151 | unlock_new_inode(inode); |
| 152 | return inode; |
| 153 | error: |
| 154 | unlock_new_inode(inode); |
| 155 | iput(inode); |
| 156 | return ERR_PTR(retval); |
| 157 | |
| 158 | } |
| 159 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 160 | struct inode * |
Aneesh Kumar K.V | a78ce05 | 2011-02-28 17:04:02 +0530 | [diff] [blame] | 161 | v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 162 | struct super_block *sb, int new) |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 163 | { |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 164 | struct p9_stat_dotl *st; |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 165 | struct inode *inode = NULL; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 166 | |
Aneesh Kumar K.V | fd2421f | 2011-07-11 16:40:59 +0000 | [diff] [blame] | 167 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC | P9_STATS_GEN); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 168 | if (IS_ERR(st)) |
| 169 | return ERR_CAST(st); |
| 170 | |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 171 | inode = v9fs_qid_iget_dotl(sb, &st->qid, fid, st, new); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 172 | kfree(st); |
Aneesh Kumar K.V | 5ffc0cb | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 173 | return inode; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 174 | } |
| 175 | |
Aneesh Kumar K.V | f88657c | 2011-08-03 19:55:32 +0530 | [diff] [blame] | 176 | struct dotl_openflag_map { |
| 177 | int open_flag; |
| 178 | int dotl_flag; |
| 179 | }; |
| 180 | |
| 181 | static int v9fs_mapped_dotl_flags(int flags) |
| 182 | { |
| 183 | int i; |
| 184 | int rflags = 0; |
| 185 | struct dotl_openflag_map dotl_oflag_map[] = { |
| 186 | { O_CREAT, P9_DOTL_CREATE }, |
| 187 | { O_EXCL, P9_DOTL_EXCL }, |
| 188 | { O_NOCTTY, P9_DOTL_NOCTTY }, |
| 189 | { O_TRUNC, P9_DOTL_TRUNC }, |
| 190 | { O_APPEND, P9_DOTL_APPEND }, |
| 191 | { O_NONBLOCK, P9_DOTL_NONBLOCK }, |
| 192 | { O_DSYNC, P9_DOTL_DSYNC }, |
| 193 | { FASYNC, P9_DOTL_FASYNC }, |
| 194 | { O_DIRECT, P9_DOTL_DIRECT }, |
| 195 | { O_LARGEFILE, P9_DOTL_LARGEFILE }, |
| 196 | { O_DIRECTORY, P9_DOTL_DIRECTORY }, |
| 197 | { O_NOFOLLOW, P9_DOTL_NOFOLLOW }, |
| 198 | { O_NOATIME, P9_DOTL_NOATIME }, |
| 199 | { O_CLOEXEC, P9_DOTL_CLOEXEC }, |
| 200 | { O_SYNC, P9_DOTL_SYNC}, |
| 201 | }; |
| 202 | for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { |
| 203 | if (flags & dotl_oflag_map[i].open_flag) |
| 204 | rflags |= dotl_oflag_map[i].dotl_flag; |
| 205 | } |
| 206 | return rflags; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * v9fs_open_to_dotl_flags- convert Linux specific open flags to |
| 211 | * plan 9 open flag. |
| 212 | * @flags: flags to convert |
| 213 | */ |
| 214 | int v9fs_open_to_dotl_flags(int flags) |
| 215 | { |
| 216 | int rflags = 0; |
| 217 | |
| 218 | /* |
| 219 | * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY |
| 220 | * and P9_DOTL_NOACCESS |
| 221 | */ |
| 222 | rflags |= flags & O_ACCMODE; |
| 223 | rflags |= v9fs_mapped_dotl_flags(flags); |
| 224 | |
| 225 | return rflags; |
| 226 | } |
| 227 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 228 | /** |
| 229 | * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. |
| 230 | * @dir: directory inode that is being created |
| 231 | * @dentry: dentry that is being deleted |
| 232 | * @mode: create permissions |
| 233 | * @nd: path information |
| 234 | * |
| 235 | */ |
| 236 | |
| 237 | static int |
Al Viro | 4acdaf2 | 2011-07-26 01:42:34 -0400 | [diff] [blame] | 238 | v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 239 | struct nameidata *nd) |
| 240 | { |
| 241 | int err = 0; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 242 | gid_t gid; |
| 243 | int flags; |
Al Viro | d3fb612 | 2011-07-23 18:37:50 -0400 | [diff] [blame] | 244 | umode_t mode; |
Aneesh Kumar K.V | 6b39f6d | 2011-02-28 17:04:03 +0530 | [diff] [blame] | 245 | char *name = NULL; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 246 | struct file *filp; |
| 247 | struct p9_qid qid; |
| 248 | struct inode *inode; |
Aneesh Kumar K.V | 6b39f6d | 2011-02-28 17:04:03 +0530 | [diff] [blame] | 249 | struct p9_fid *fid = NULL; |
| 250 | struct v9fs_inode *v9inode; |
| 251 | struct p9_fid *dfid, *ofid, *inode_fid; |
| 252 | struct v9fs_session_info *v9ses; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 253 | struct posix_acl *pacl = NULL, *dacl = NULL; |
| 254 | |
| 255 | v9ses = v9fs_inode2v9ses(dir); |
Al Viro | dd7dd55 | 2011-06-25 21:17:17 -0400 | [diff] [blame] | 256 | if (nd) |
Al Viro | 8a5e929 | 2011-06-25 19:15:54 -0400 | [diff] [blame] | 257 | flags = nd->intent.open.flags; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 258 | else { |
| 259 | /* |
| 260 | * create call without LOOKUP_OPEN is due |
| 261 | * to mknod of regular files. So use mknod |
| 262 | * operation. |
| 263 | */ |
| 264 | return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); |
| 265 | } |
| 266 | |
| 267 | name = (char *) dentry->d_name.name; |
Linus Torvalds | 609eac1 | 2012-01-10 15:09:01 -0800 | [diff] [blame] | 268 | p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%hx\n", |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 269 | name, flags, omode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 270 | |
| 271 | dfid = v9fs_fid_lookup(dentry->d_parent); |
| 272 | if (IS_ERR(dfid)) { |
| 273 | err = PTR_ERR(dfid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 274 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 275 | return err; |
| 276 | } |
| 277 | |
| 278 | /* clone a fid to use for creation */ |
| 279 | ofid = p9_client_walk(dfid, 0, NULL, 1); |
| 280 | if (IS_ERR(ofid)) { |
| 281 | err = PTR_ERR(ofid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 282 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 283 | return err; |
| 284 | } |
| 285 | |
| 286 | gid = v9fs_get_fsgid_for_create(dir); |
| 287 | |
| 288 | mode = omode; |
| 289 | /* Update mode based on ACL value */ |
| 290 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); |
| 291 | if (err) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 292 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n", |
| 293 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 294 | goto error; |
| 295 | } |
Aneesh Kumar K.V | f88657c | 2011-08-03 19:55:32 +0530 | [diff] [blame] | 296 | err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), |
| 297 | mode, gid, &qid); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 298 | if (err < 0) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 299 | p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n", |
| 300 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 301 | goto error; |
| 302 | } |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 303 | v9fs_invalidate_inode_attr(dir); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 304 | |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 305 | /* instantiate inode and assign the unopened fid to the dentry */ |
| 306 | fid = p9_client_walk(dfid, 1, &name, 1); |
| 307 | if (IS_ERR(fid)) { |
| 308 | err = PTR_ERR(fid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 309 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 310 | fid = NULL; |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 311 | goto error; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 312 | } |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 313 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 314 | if (IS_ERR(inode)) { |
| 315 | err = PTR_ERR(inode); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 316 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 317 | goto error; |
| 318 | } |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 319 | err = v9fs_fid_add(dentry, fid); |
| 320 | if (err < 0) |
| 321 | goto error; |
Aneesh Kumar K.V | 5441ae5 | 2011-07-25 18:06:32 +0000 | [diff] [blame] | 322 | d_instantiate(dentry, inode); |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 323 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 324 | /* Now set the ACL based on the default value */ |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 325 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
Aneesh Kumar K.V | 6b39f6d | 2011-02-28 17:04:03 +0530 | [diff] [blame] | 326 | |
| 327 | v9inode = V9FS_I(inode); |
Aneesh Kumar K.V | 5a7e0a8 | 2011-03-08 16:39:46 +0530 | [diff] [blame] | 328 | mutex_lock(&v9inode->v_mutex); |
Aneesh Kumar K.V | 7add697 | 2011-03-08 16:39:49 +0530 | [diff] [blame] | 329 | if (v9ses->cache && !v9inode->writeback_fid && |
| 330 | ((flags & O_ACCMODE) != O_RDONLY)) { |
Aneesh Kumar K.V | 3cf387d | 2011-02-28 17:03:57 +0530 | [diff] [blame] | 331 | /* |
Aneesh Kumar K.V | 6b39f6d | 2011-02-28 17:04:03 +0530 | [diff] [blame] | 332 | * clone a fid and add it to writeback_fid |
Aneesh Kumar K.V | 3cf387d | 2011-02-28 17:03:57 +0530 | [diff] [blame] | 333 | * we do it during open time instead of |
| 334 | * page dirty time via write_begin/page_mkwrite |
| 335 | * because we want write after unlink usecase |
| 336 | * to work. |
| 337 | */ |
| 338 | inode_fid = v9fs_writeback_fid(dentry); |
| 339 | if (IS_ERR(inode_fid)) { |
| 340 | err = PTR_ERR(inode_fid); |
Aneesh Kumar K.V | 5a7e0a8 | 2011-03-08 16:39:46 +0530 | [diff] [blame] | 341 | mutex_unlock(&v9inode->v_mutex); |
Aneesh Kumar K.V | 398c4f0 | 2011-05-20 18:55:51 +0000 | [diff] [blame] | 342 | goto err_clunk_old_fid; |
Aneesh Kumar K.V | 3cf387d | 2011-02-28 17:03:57 +0530 | [diff] [blame] | 343 | } |
Aneesh Kumar K.V | 6b39f6d | 2011-02-28 17:04:03 +0530 | [diff] [blame] | 344 | v9inode->writeback_fid = (void *) inode_fid; |
Aneesh Kumar K.V | 3cf387d | 2011-02-28 17:03:57 +0530 | [diff] [blame] | 345 | } |
Aneesh Kumar K.V | 5a7e0a8 | 2011-03-08 16:39:46 +0530 | [diff] [blame] | 346 | mutex_unlock(&v9inode->v_mutex); |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 347 | /* Since we are opening a file, assign the open fid to the file */ |
| 348 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); |
| 349 | if (IS_ERR(filp)) { |
Aneesh Kumar K.V | 398c4f0 | 2011-05-20 18:55:51 +0000 | [diff] [blame] | 350 | err = PTR_ERR(filp); |
| 351 | goto err_clunk_old_fid; |
Aneesh Kumar K.V | af7542f | 2011-01-10 14:22:21 -0600 | [diff] [blame] | 352 | } |
| 353 | filp->private_data = ofid; |
Aneesh Kumar K.V | 46848de | 2011-02-28 17:03:55 +0530 | [diff] [blame] | 354 | #ifdef CONFIG_9P_FSCACHE |
| 355 | if (v9ses->cache) |
| 356 | v9fs_cache_inode_set_cookie(inode, filp); |
| 357 | #endif |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 358 | return 0; |
| 359 | |
| 360 | error: |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 361 | if (fid) |
| 362 | p9_client_clunk(fid); |
Aneesh Kumar K.V | 398c4f0 | 2011-05-20 18:55:51 +0000 | [diff] [blame] | 363 | err_clunk_old_fid: |
| 364 | if (ofid) |
| 365 | p9_client_clunk(ofid); |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 366 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 367 | return err; |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory |
| 372 | * @dir: inode that is being unlinked |
| 373 | * @dentry: dentry that is being unlinked |
| 374 | * @mode: mode for new directory |
| 375 | * |
| 376 | */ |
| 377 | |
| 378 | static int v9fs_vfs_mkdir_dotl(struct inode *dir, |
Al Viro | 18bb1db | 2011-07-26 01:41:39 -0400 | [diff] [blame] | 379 | struct dentry *dentry, umode_t omode) |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 380 | { |
| 381 | int err; |
| 382 | struct v9fs_session_info *v9ses; |
| 383 | struct p9_fid *fid = NULL, *dfid = NULL; |
| 384 | gid_t gid; |
| 385 | char *name; |
Al Viro | d3fb612 | 2011-07-23 18:37:50 -0400 | [diff] [blame] | 386 | umode_t mode; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 387 | struct inode *inode; |
| 388 | struct p9_qid qid; |
| 389 | struct dentry *dir_dentry; |
| 390 | struct posix_acl *dacl = NULL, *pacl = NULL; |
| 391 | |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 392 | p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 393 | err = 0; |
| 394 | v9ses = v9fs_inode2v9ses(dir); |
| 395 | |
| 396 | omode |= S_IFDIR; |
| 397 | if (dir->i_mode & S_ISGID) |
| 398 | omode |= S_ISGID; |
| 399 | |
Al Viro | af56959 | 2012-04-02 20:02:53 -0400 | [diff] [blame] | 400 | dir_dentry = dentry->d_parent; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 401 | dfid = v9fs_fid_lookup(dir_dentry); |
| 402 | if (IS_ERR(dfid)) { |
| 403 | err = PTR_ERR(dfid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 404 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 405 | dfid = NULL; |
| 406 | goto error; |
| 407 | } |
| 408 | |
| 409 | gid = v9fs_get_fsgid_for_create(dir); |
| 410 | mode = omode; |
| 411 | /* Update mode based on ACL value */ |
| 412 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); |
| 413 | if (err) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 414 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n", |
| 415 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 416 | goto error; |
| 417 | } |
| 418 | name = (char *) dentry->d_name.name; |
| 419 | err = p9_client_mkdir_dotl(dfid, name, mode, gid, &qid); |
| 420 | if (err < 0) |
| 421 | goto error; |
| 422 | |
| 423 | /* instantiate inode and assign the unopened fid to the dentry */ |
| 424 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 425 | fid = p9_client_walk(dfid, 1, &name, 1); |
| 426 | if (IS_ERR(fid)) { |
| 427 | err = PTR_ERR(fid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 428 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
| 429 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 430 | fid = NULL; |
| 431 | goto error; |
| 432 | } |
| 433 | |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 434 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 435 | if (IS_ERR(inode)) { |
| 436 | err = PTR_ERR(inode); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 437 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
| 438 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 439 | goto error; |
| 440 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 441 | err = v9fs_fid_add(dentry, fid); |
| 442 | if (err < 0) |
| 443 | goto error; |
Aneesh Kumar K.V | 5441ae5 | 2011-07-25 18:06:32 +0000 | [diff] [blame] | 444 | d_instantiate(dentry, inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 445 | fid = NULL; |
| 446 | } else { |
| 447 | /* |
| 448 | * Not in cached mode. No need to populate |
| 449 | * inode with stat. We need to get an inode |
| 450 | * so that we can set the acl with dentry |
| 451 | */ |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 452 | inode = v9fs_get_inode(dir->i_sb, mode, 0); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 453 | if (IS_ERR(inode)) { |
| 454 | err = PTR_ERR(inode); |
| 455 | goto error; |
| 456 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 457 | d_instantiate(dentry, inode); |
| 458 | } |
| 459 | /* Now set the ACL based on the default value */ |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 460 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
Aneesh Kumar K.V | b271ec4 | 2011-02-28 17:04:05 +0530 | [diff] [blame] | 461 | inc_nlink(dir); |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 462 | v9fs_invalidate_inode_attr(dir); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 463 | error: |
| 464 | if (fid) |
| 465 | p9_client_clunk(fid); |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 466 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 467 | return err; |
| 468 | } |
| 469 | |
| 470 | static int |
| 471 | v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, |
| 472 | struct kstat *stat) |
| 473 | { |
| 474 | int err; |
| 475 | struct v9fs_session_info *v9ses; |
| 476 | struct p9_fid *fid; |
| 477 | struct p9_stat_dotl *st; |
| 478 | |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 479 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 480 | err = -EPERM; |
Aneesh Kumar K.V | 42869c8 | 2011-03-08 16:39:50 +0530 | [diff] [blame] | 481 | v9ses = v9fs_dentry2v9ses(dentry); |
Aneesh Kumar K.V | a121190 | 2011-02-28 17:04:01 +0530 | [diff] [blame] | 482 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 483 | generic_fillattr(dentry->d_inode, stat); |
| 484 | return 0; |
| 485 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 486 | fid = v9fs_fid_lookup(dentry); |
| 487 | if (IS_ERR(fid)) |
| 488 | return PTR_ERR(fid); |
| 489 | |
| 490 | /* Ask for all the fields in stat structure. Server will return |
| 491 | * whatever it supports |
| 492 | */ |
| 493 | |
| 494 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); |
| 495 | if (IS_ERR(st)) |
| 496 | return PTR_ERR(st); |
| 497 | |
| 498 | v9fs_stat2inode_dotl(st, dentry->d_inode); |
| 499 | generic_fillattr(dentry->d_inode, stat); |
| 500 | /* Change block size to what the server returned */ |
| 501 | stat->blksize = st->st_blksize; |
| 502 | |
| 503 | kfree(st); |
| 504 | return 0; |
| 505 | } |
| 506 | |
Aneesh Kumar K.V | f766619 | 2011-12-18 23:03:13 +0530 | [diff] [blame] | 507 | /* |
| 508 | * Attribute flags. |
| 509 | */ |
| 510 | #define P9_ATTR_MODE (1 << 0) |
| 511 | #define P9_ATTR_UID (1 << 1) |
| 512 | #define P9_ATTR_GID (1 << 2) |
| 513 | #define P9_ATTR_SIZE (1 << 3) |
| 514 | #define P9_ATTR_ATIME (1 << 4) |
| 515 | #define P9_ATTR_MTIME (1 << 5) |
| 516 | #define P9_ATTR_CTIME (1 << 6) |
| 517 | #define P9_ATTR_ATIME_SET (1 << 7) |
| 518 | #define P9_ATTR_MTIME_SET (1 << 8) |
| 519 | |
| 520 | struct dotl_iattr_map { |
| 521 | int iattr_valid; |
| 522 | int p9_iattr_valid; |
| 523 | }; |
| 524 | |
| 525 | static int v9fs_mapped_iattr_valid(int iattr_valid) |
| 526 | { |
| 527 | int i; |
| 528 | int p9_iattr_valid = 0; |
| 529 | struct dotl_iattr_map dotl_iattr_map[] = { |
| 530 | { ATTR_MODE, P9_ATTR_MODE }, |
| 531 | { ATTR_UID, P9_ATTR_UID }, |
| 532 | { ATTR_GID, P9_ATTR_GID }, |
| 533 | { ATTR_SIZE, P9_ATTR_SIZE }, |
| 534 | { ATTR_ATIME, P9_ATTR_ATIME }, |
| 535 | { ATTR_MTIME, P9_ATTR_MTIME }, |
| 536 | { ATTR_CTIME, P9_ATTR_CTIME }, |
| 537 | { ATTR_ATIME_SET, P9_ATTR_ATIME_SET }, |
| 538 | { ATTR_MTIME_SET, P9_ATTR_MTIME_SET }, |
| 539 | }; |
| 540 | for (i = 0; i < ARRAY_SIZE(dotl_iattr_map); i++) { |
| 541 | if (iattr_valid & dotl_iattr_map[i].iattr_valid) |
| 542 | p9_iattr_valid |= dotl_iattr_map[i].p9_iattr_valid; |
| 543 | } |
| 544 | return p9_iattr_valid; |
| 545 | } |
| 546 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 547 | /** |
| 548 | * v9fs_vfs_setattr_dotl - set file metadata |
| 549 | * @dentry: file whose metadata to set |
| 550 | * @iattr: metadata assignment structure |
| 551 | * |
| 552 | */ |
| 553 | |
| 554 | int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) |
| 555 | { |
| 556 | int retval; |
| 557 | struct v9fs_session_info *v9ses; |
| 558 | struct p9_fid *fid; |
| 559 | struct p9_iattr_dotl p9attr; |
| 560 | |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 561 | p9_debug(P9_DEBUG_VFS, "\n"); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 562 | |
| 563 | retval = inode_change_ok(dentry->d_inode, iattr); |
| 564 | if (retval) |
| 565 | return retval; |
| 566 | |
Aneesh Kumar K.V | f766619 | 2011-12-18 23:03:13 +0530 | [diff] [blame] | 567 | p9attr.valid = v9fs_mapped_iattr_valid(iattr->ia_valid); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 568 | p9attr.mode = iattr->ia_mode; |
| 569 | p9attr.uid = iattr->ia_uid; |
| 570 | p9attr.gid = iattr->ia_gid; |
| 571 | p9attr.size = iattr->ia_size; |
| 572 | p9attr.atime_sec = iattr->ia_atime.tv_sec; |
| 573 | p9attr.atime_nsec = iattr->ia_atime.tv_nsec; |
| 574 | p9attr.mtime_sec = iattr->ia_mtime.tv_sec; |
| 575 | p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec; |
| 576 | |
| 577 | retval = -EPERM; |
Aneesh Kumar K.V | 42869c8 | 2011-03-08 16:39:50 +0530 | [diff] [blame] | 578 | v9ses = v9fs_dentry2v9ses(dentry); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 579 | fid = v9fs_fid_lookup(dentry); |
| 580 | if (IS_ERR(fid)) |
| 581 | return PTR_ERR(fid); |
| 582 | |
Aneesh Kumar K.V | 3dc5436 | 2011-02-28 17:04:11 +0530 | [diff] [blame] | 583 | /* Write all dirty data */ |
| 584 | if (S_ISREG(dentry->d_inode->i_mode)) |
| 585 | filemap_write_and_wait(dentry->d_inode->i_mapping); |
| 586 | |
Aneesh Kumar K.V | f10fc50 | 2011-02-28 17:04:10 +0530 | [diff] [blame] | 587 | retval = p9_client_setattr(fid, &p9attr); |
| 588 | if (retval < 0) |
| 589 | return retval; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 590 | |
Aneesh Kumar K.V | 059c138 | 2011-03-08 16:39:48 +0530 | [diff] [blame] | 591 | if ((iattr->ia_valid & ATTR_SIZE) && |
| 592 | iattr->ia_size != i_size_read(dentry->d_inode)) |
| 593 | truncate_setsize(dentry->d_inode, iattr->ia_size); |
| 594 | |
| 595 | v9fs_invalidate_inode_attr(dentry->d_inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 596 | setattr_copy(dentry->d_inode, iattr); |
| 597 | mark_inode_dirty(dentry->d_inode); |
| 598 | if (iattr->ia_valid & ATTR_MODE) { |
| 599 | /* We also want to update ACL when we update mode bits */ |
| 600 | retval = v9fs_acl_chmod(dentry); |
| 601 | if (retval < 0) |
| 602 | return retval; |
| 603 | } |
| 604 | return 0; |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * v9fs_stat2inode_dotl - populate an inode structure with stat info |
| 609 | * @stat: stat structure |
| 610 | * @inode: inode to populate |
| 611 | * @sb: superblock of filesystem |
| 612 | * |
| 613 | */ |
| 614 | |
| 615 | void |
| 616 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) |
| 617 | { |
Al Viro | 3eda0de | 2011-07-26 02:53:22 -0400 | [diff] [blame] | 618 | umode_t mode; |
Aneesh Kumar K.V | b3cbea0 | 2011-02-28 17:04:06 +0530 | [diff] [blame] | 619 | struct v9fs_inode *v9inode = V9FS_I(inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 620 | |
| 621 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { |
| 622 | inode->i_atime.tv_sec = stat->st_atime_sec; |
| 623 | inode->i_atime.tv_nsec = stat->st_atime_nsec; |
| 624 | inode->i_mtime.tv_sec = stat->st_mtime_sec; |
| 625 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; |
| 626 | inode->i_ctime.tv_sec = stat->st_ctime_sec; |
| 627 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; |
| 628 | inode->i_uid = stat->st_uid; |
| 629 | inode->i_gid = stat->st_gid; |
Miklos Szeredi | bfe8684 | 2011-10-28 14:13:29 +0200 | [diff] [blame] | 630 | set_nlink(inode, stat->st_nlink); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 631 | |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 632 | mode = stat->st_mode & S_IALLUGO; |
| 633 | mode |= inode->i_mode & ~S_IALLUGO; |
| 634 | inode->i_mode = mode; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 635 | |
| 636 | i_size_write(inode, stat->st_size); |
| 637 | inode->i_blocks = stat->st_blocks; |
| 638 | } else { |
| 639 | if (stat->st_result_mask & P9_STATS_ATIME) { |
| 640 | inode->i_atime.tv_sec = stat->st_atime_sec; |
| 641 | inode->i_atime.tv_nsec = stat->st_atime_nsec; |
| 642 | } |
| 643 | if (stat->st_result_mask & P9_STATS_MTIME) { |
| 644 | inode->i_mtime.tv_sec = stat->st_mtime_sec; |
| 645 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; |
| 646 | } |
| 647 | if (stat->st_result_mask & P9_STATS_CTIME) { |
| 648 | inode->i_ctime.tv_sec = stat->st_ctime_sec; |
| 649 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; |
| 650 | } |
| 651 | if (stat->st_result_mask & P9_STATS_UID) |
| 652 | inode->i_uid = stat->st_uid; |
| 653 | if (stat->st_result_mask & P9_STATS_GID) |
| 654 | inode->i_gid = stat->st_gid; |
| 655 | if (stat->st_result_mask & P9_STATS_NLINK) |
Miklos Szeredi | bfe8684 | 2011-10-28 14:13:29 +0200 | [diff] [blame] | 656 | set_nlink(inode, stat->st_nlink); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 657 | if (stat->st_result_mask & P9_STATS_MODE) { |
| 658 | inode->i_mode = stat->st_mode; |
| 659 | if ((S_ISBLK(inode->i_mode)) || |
| 660 | (S_ISCHR(inode->i_mode))) |
| 661 | init_special_inode(inode, inode->i_mode, |
| 662 | inode->i_rdev); |
| 663 | } |
| 664 | if (stat->st_result_mask & P9_STATS_RDEV) |
| 665 | inode->i_rdev = new_decode_dev(stat->st_rdev); |
| 666 | if (stat->st_result_mask & P9_STATS_SIZE) |
| 667 | i_size_write(inode, stat->st_size); |
| 668 | if (stat->st_result_mask & P9_STATS_BLOCKS) |
| 669 | inode->i_blocks = stat->st_blocks; |
| 670 | } |
| 671 | if (stat->st_result_mask & P9_STATS_GEN) |
Aneesh Kumar K.V | fd2421f | 2011-07-11 16:40:59 +0000 | [diff] [blame] | 672 | inode->i_generation = stat->st_gen; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 673 | |
| 674 | /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION |
| 675 | * because the inode structure does not have fields for them. |
| 676 | */ |
Aneesh Kumar K.V | b3cbea0 | 2011-02-28 17:04:06 +0530 | [diff] [blame] | 677 | v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | static int |
| 681 | v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, |
| 682 | const char *symname) |
| 683 | { |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 684 | int err; |
| 685 | gid_t gid; |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 686 | char *name; |
| 687 | struct p9_qid qid; |
| 688 | struct inode *inode; |
| 689 | struct p9_fid *dfid; |
| 690 | struct p9_fid *fid = NULL; |
| 691 | struct v9fs_session_info *v9ses; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 692 | |
| 693 | name = (char *) dentry->d_name.name; |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 694 | p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 695 | v9ses = v9fs_inode2v9ses(dir); |
| 696 | |
| 697 | dfid = v9fs_fid_lookup(dentry->d_parent); |
| 698 | if (IS_ERR(dfid)) { |
| 699 | err = PTR_ERR(dfid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 700 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 701 | return err; |
| 702 | } |
| 703 | |
| 704 | gid = v9fs_get_fsgid_for_create(dir); |
| 705 | |
| 706 | /* Server doesn't alter fid on TSYMLINK. Hence no need to clone it. */ |
| 707 | err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid); |
| 708 | |
| 709 | if (err < 0) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 710 | p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 711 | goto error; |
| 712 | } |
| 713 | |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 714 | v9fs_invalidate_inode_attr(dir); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 715 | if (v9ses->cache) { |
| 716 | /* Now walk from the parent so we can get an unopened fid. */ |
| 717 | fid = p9_client_walk(dfid, 1, &name, 1); |
| 718 | if (IS_ERR(fid)) { |
| 719 | err = PTR_ERR(fid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 720 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
| 721 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 722 | fid = NULL; |
| 723 | goto error; |
| 724 | } |
| 725 | |
| 726 | /* instantiate inode and assign the unopened fid to dentry */ |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 727 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 728 | if (IS_ERR(inode)) { |
| 729 | err = PTR_ERR(inode); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 730 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
| 731 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 732 | goto error; |
| 733 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 734 | err = v9fs_fid_add(dentry, fid); |
| 735 | if (err < 0) |
| 736 | goto error; |
Aneesh Kumar K.V | 5441ae5 | 2011-07-25 18:06:32 +0000 | [diff] [blame] | 737 | d_instantiate(dentry, inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 738 | fid = NULL; |
| 739 | } else { |
| 740 | /* Not in cached mode. No need to populate inode with stat */ |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 741 | inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 742 | if (IS_ERR(inode)) { |
| 743 | err = PTR_ERR(inode); |
| 744 | goto error; |
| 745 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 746 | d_instantiate(dentry, inode); |
| 747 | } |
| 748 | |
| 749 | error: |
| 750 | if (fid) |
| 751 | p9_client_clunk(fid); |
| 752 | |
| 753 | return err; |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * v9fs_vfs_link_dotl - create a hardlink for dotl |
| 758 | * @old_dentry: dentry for file to link to |
| 759 | * @dir: inode destination for new link |
| 760 | * @dentry: dentry for link |
| 761 | * |
| 762 | */ |
| 763 | |
| 764 | static int |
| 765 | v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, |
| 766 | struct dentry *dentry) |
| 767 | { |
| 768 | int err; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 769 | char *name; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 770 | struct dentry *dir_dentry; |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 771 | struct p9_fid *dfid, *oldfid; |
| 772 | struct v9fs_session_info *v9ses; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 773 | |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 774 | p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", |
| 775 | dir->i_ino, old_dentry->d_name.name, dentry->d_name.name); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 776 | |
| 777 | v9ses = v9fs_inode2v9ses(dir); |
Al Viro | af56959 | 2012-04-02 20:02:53 -0400 | [diff] [blame] | 778 | dir_dentry = dentry->d_parent; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 779 | dfid = v9fs_fid_lookup(dir_dentry); |
| 780 | if (IS_ERR(dfid)) |
| 781 | return PTR_ERR(dfid); |
| 782 | |
| 783 | oldfid = v9fs_fid_lookup(old_dentry); |
| 784 | if (IS_ERR(oldfid)) |
| 785 | return PTR_ERR(oldfid); |
| 786 | |
| 787 | name = (char *) dentry->d_name.name; |
| 788 | |
| 789 | err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name); |
| 790 | |
| 791 | if (err < 0) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 792 | p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 793 | return err; |
| 794 | } |
| 795 | |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 796 | v9fs_invalidate_inode_attr(dir); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 797 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 798 | /* Get the latest stat info from server. */ |
| 799 | struct p9_fid *fid; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 800 | fid = v9fs_fid_lookup(old_dentry); |
| 801 | if (IS_ERR(fid)) |
| 802 | return PTR_ERR(fid); |
| 803 | |
Aneesh Kumar K.V | c06c066 | 2011-02-28 17:04:09 +0530 | [diff] [blame] | 804 | v9fs_refresh_inode_dotl(fid, old_dentry->d_inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 805 | } |
Aneesh Kumar K.V | 20656a4 | 2011-02-28 17:03:55 +0530 | [diff] [blame] | 806 | ihold(old_dentry->d_inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 807 | d_instantiate(dentry, old_dentry->d_inode); |
| 808 | |
| 809 | return err; |
| 810 | } |
| 811 | |
| 812 | /** |
| 813 | * v9fs_vfs_mknod_dotl - create a special file |
| 814 | * @dir: inode destination for new link |
| 815 | * @dentry: dentry for file |
| 816 | * @mode: mode for creation |
| 817 | * @rdev: device associated with special file |
| 818 | * |
| 819 | */ |
| 820 | static int |
Al Viro | 1a67aaf | 2011-07-26 01:52:52 -0400 | [diff] [blame] | 821 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 822 | dev_t rdev) |
| 823 | { |
| 824 | int err; |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 825 | gid_t gid; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 826 | char *name; |
Al Viro | d3fb612 | 2011-07-23 18:37:50 -0400 | [diff] [blame] | 827 | umode_t mode; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 828 | struct v9fs_session_info *v9ses; |
| 829 | struct p9_fid *fid = NULL, *dfid = NULL; |
| 830 | struct inode *inode; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 831 | struct p9_qid qid; |
| 832 | struct dentry *dir_dentry; |
| 833 | struct posix_acl *dacl = NULL, *pacl = NULL; |
| 834 | |
Linus Torvalds | 609eac1 | 2012-01-10 15:09:01 -0800 | [diff] [blame] | 835 | p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 836 | dir->i_ino, dentry->d_name.name, omode, |
| 837 | MAJOR(rdev), MINOR(rdev)); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 838 | |
| 839 | if (!new_valid_dev(rdev)) |
| 840 | return -EINVAL; |
| 841 | |
| 842 | v9ses = v9fs_inode2v9ses(dir); |
Al Viro | af56959 | 2012-04-02 20:02:53 -0400 | [diff] [blame] | 843 | dir_dentry = dentry->d_parent; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 844 | dfid = v9fs_fid_lookup(dir_dentry); |
| 845 | if (IS_ERR(dfid)) { |
| 846 | err = PTR_ERR(dfid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 847 | p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 848 | dfid = NULL; |
| 849 | goto error; |
| 850 | } |
| 851 | |
| 852 | gid = v9fs_get_fsgid_for_create(dir); |
| 853 | mode = omode; |
| 854 | /* Update mode based on ACL value */ |
| 855 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); |
| 856 | if (err) { |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 857 | p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n", |
| 858 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 859 | goto error; |
| 860 | } |
| 861 | name = (char *) dentry->d_name.name; |
| 862 | |
| 863 | err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid); |
| 864 | if (err < 0) |
| 865 | goto error; |
| 866 | |
Aneesh Kumar K.V | d28c61f | 2011-02-28 17:04:08 +0530 | [diff] [blame] | 867 | v9fs_invalidate_inode_attr(dir); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 868 | /* instantiate inode and assign the unopened fid to the dentry */ |
| 869 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 870 | fid = p9_client_walk(dfid, 1, &name, 1); |
| 871 | if (IS_ERR(fid)) { |
| 872 | err = PTR_ERR(fid); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 873 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", |
| 874 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 875 | fid = NULL; |
| 876 | goto error; |
| 877 | } |
| 878 | |
Aneesh Kumar K.V | ed80fcf | 2011-07-06 16:32:31 +0530 | [diff] [blame] | 879 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 880 | if (IS_ERR(inode)) { |
| 881 | err = PTR_ERR(inode); |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 882 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", |
| 883 | err); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 884 | goto error; |
| 885 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 886 | err = v9fs_fid_add(dentry, fid); |
| 887 | if (err < 0) |
| 888 | goto error; |
Aneesh Kumar K.V | 5441ae5 | 2011-07-25 18:06:32 +0000 | [diff] [blame] | 889 | d_instantiate(dentry, inode); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 890 | fid = NULL; |
| 891 | } else { |
| 892 | /* |
| 893 | * Not in cached mode. No need to populate inode with stat. |
| 894 | * socket syscall returns a fd, so we need instantiate |
| 895 | */ |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 896 | inode = v9fs_get_inode(dir->i_sb, mode, rdev); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 897 | if (IS_ERR(inode)) { |
| 898 | err = PTR_ERR(inode); |
| 899 | goto error; |
| 900 | } |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 901 | d_instantiate(dentry, inode); |
| 902 | } |
| 903 | /* Now set the ACL based on the default value */ |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 904 | v9fs_set_create_acl(dentry, &dacl, &pacl); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 905 | error: |
| 906 | if (fid) |
| 907 | p9_client_clunk(fid); |
Al Viro | 1ec95bf | 2011-07-23 02:28:13 -0400 | [diff] [blame] | 908 | v9fs_set_create_acl(NULL, &dacl, &pacl); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 909 | return err; |
| 910 | } |
| 911 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 912 | /** |
| 913 | * v9fs_vfs_follow_link_dotl - follow a symlink path |
| 914 | * @dentry: dentry for symlink |
| 915 | * @nd: nameidata |
| 916 | * |
| 917 | */ |
| 918 | |
| 919 | static void * |
| 920 | v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) |
| 921 | { |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 922 | int retval; |
| 923 | struct p9_fid *fid; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 924 | char *link = __getname(); |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 925 | char *target; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 926 | |
Joe Perches | 5d38515 | 2011-11-28 10:40:46 -0800 | [diff] [blame] | 927 | p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 928 | |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 929 | if (!link) { |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 930 | link = ERR_PTR(-ENOMEM); |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 931 | goto ndset; |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 932 | } |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 933 | fid = v9fs_fid_lookup(dentry); |
| 934 | if (IS_ERR(fid)) { |
| 935 | __putname(link); |
Aneesh Kumar K.V | 936bb2d | 2011-03-24 23:04:41 +0530 | [diff] [blame] | 936 | link = ERR_CAST(fid); |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 937 | goto ndset; |
| 938 | } |
| 939 | retval = p9_client_readlink(fid, &target); |
| 940 | if (!retval) { |
| 941 | strcpy(link, target); |
| 942 | kfree(target); |
| 943 | goto ndset; |
| 944 | } |
| 945 | __putname(link); |
| 946 | link = ERR_PTR(retval); |
| 947 | ndset: |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 948 | nd_set_link(nd, link); |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 949 | return NULL; |
| 950 | } |
| 951 | |
Aneesh Kumar K.V | b3cbea0 | 2011-02-28 17:04:06 +0530 | [diff] [blame] | 952 | int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) |
| 953 | { |
| 954 | loff_t i_size; |
| 955 | struct p9_stat_dotl *st; |
| 956 | struct v9fs_session_info *v9ses; |
| 957 | |
| 958 | v9ses = v9fs_inode2v9ses(inode); |
| 959 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); |
| 960 | if (IS_ERR(st)) |
| 961 | return PTR_ERR(st); |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 962 | /* |
| 963 | * Don't update inode if the file type is different |
| 964 | */ |
| 965 | if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) |
| 966 | goto out; |
Aneesh Kumar K.V | b3cbea0 | 2011-02-28 17:04:06 +0530 | [diff] [blame] | 967 | |
| 968 | spin_lock(&inode->i_lock); |
| 969 | /* |
| 970 | * We don't want to refresh inode->i_size, |
| 971 | * because we may have cached data |
| 972 | */ |
| 973 | i_size = inode->i_size; |
| 974 | v9fs_stat2inode_dotl(st, inode); |
| 975 | if (v9ses->cache) |
| 976 | inode->i_size = i_size; |
| 977 | spin_unlock(&inode->i_lock); |
Aneesh Kumar K.V | 4508914 | 2011-07-25 18:06:33 +0000 | [diff] [blame] | 978 | out: |
Aneesh Kumar K.V | b3cbea0 | 2011-02-28 17:04:06 +0530 | [diff] [blame] | 979 | kfree(st); |
| 980 | return 0; |
| 981 | } |
| 982 | |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 983 | const struct inode_operations v9fs_dir_inode_operations_dotl = { |
| 984 | .create = v9fs_vfs_create_dotl, |
| 985 | .lookup = v9fs_vfs_lookup, |
| 986 | .link = v9fs_vfs_link_dotl, |
| 987 | .symlink = v9fs_vfs_symlink_dotl, |
| 988 | .unlink = v9fs_vfs_unlink, |
| 989 | .mkdir = v9fs_vfs_mkdir_dotl, |
| 990 | .rmdir = v9fs_vfs_rmdir, |
| 991 | .mknod = v9fs_vfs_mknod_dotl, |
| 992 | .rename = v9fs_vfs_rename, |
| 993 | .getattr = v9fs_vfs_getattr_dotl, |
| 994 | .setattr = v9fs_vfs_setattr_dotl, |
| 995 | .setxattr = generic_setxattr, |
| 996 | .getxattr = generic_getxattr, |
| 997 | .removexattr = generic_removexattr, |
| 998 | .listxattr = v9fs_listxattr, |
Christoph Hellwig | 4e34e71 | 2011-07-23 17:37:31 +0200 | [diff] [blame] | 999 | .get_acl = v9fs_iop_get_acl, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 1000 | }; |
| 1001 | |
| 1002 | const struct inode_operations v9fs_file_inode_operations_dotl = { |
| 1003 | .getattr = v9fs_vfs_getattr_dotl, |
| 1004 | .setattr = v9fs_vfs_setattr_dotl, |
| 1005 | .setxattr = generic_setxattr, |
| 1006 | .getxattr = generic_getxattr, |
| 1007 | .removexattr = generic_removexattr, |
| 1008 | .listxattr = v9fs_listxattr, |
Christoph Hellwig | 4e34e71 | 2011-07-23 17:37:31 +0200 | [diff] [blame] | 1009 | .get_acl = v9fs_iop_get_acl, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 1010 | }; |
| 1011 | |
| 1012 | const struct inode_operations v9fs_symlink_inode_operations_dotl = { |
M. Mohan Kumar | 31b6cea | 2011-01-08 07:28:46 +0530 | [diff] [blame] | 1013 | .readlink = generic_readlink, |
Aneesh Kumar K.V | 53c06f4 | 2011-01-10 13:51:47 -0600 | [diff] [blame] | 1014 | .follow_link = v9fs_vfs_follow_link_dotl, |
| 1015 | .put_link = v9fs_vfs_put_link, |
| 1016 | .getattr = v9fs_vfs_getattr_dotl, |
| 1017 | .setattr = v9fs_vfs_setattr_dotl, |
| 1018 | .setxattr = generic_setxattr, |
| 1019 | .getxattr = generic_getxattr, |
| 1020 | .removexattr = generic_removexattr, |
| 1021 | .listxattr = v9fs_listxattr, |
| 1022 | }; |