blob: 0c958cf7775880ce0a8004d38caa424887387edd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include "xfs.h"
19#include "xfs_fs.h"
Nathan Scotta844f452005-11-02 14:38:42 +110020#include "xfs_bit.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include "xfs_log.h"
Nathan Scotta844f452005-11-02 14:38:42 +110022#include "xfs_inum.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "xfs_trans.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include "xfs_dir2.h"
27#include "xfs_alloc.h"
28#include "xfs_dmapi.h"
29#include "xfs_quota.h"
30#include "xfs_mount.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include "xfs_bmap_btree.h"
Nathan Scotta844f452005-11-02 14:38:42 +110032#include "xfs_alloc_btree.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include "xfs_ialloc_btree.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include "xfs_dir2_sf.h"
Nathan Scotta844f452005-11-02 14:38:42 +110035#include "xfs_attr_sf.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include "xfs_dinode.h"
37#include "xfs_inode.h"
38#include "xfs_bmap.h"
Nathan Scotta844f452005-11-02 14:38:42 +110039#include "xfs_btree.h"
40#include "xfs_ialloc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#include "xfs_rtalloc.h"
42#include "xfs_error.h"
43#include "xfs_itable.h"
44#include "xfs_rw.h"
45#include "xfs_acl.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include "xfs_attr.h"
47#include "xfs_buf_item.h"
48#include "xfs_utils.h"
Christoph Hellwig739bfb22007-08-29 10:58:01 +100049#include "xfs_vnodeops.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Randy Dunlap16f7e0f2006-01-11 12:17:46 -080051#include <linux/capability.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#include <linux/xattr.h>
53#include <linux/namei.h>
Nathan Scott446ada42006-01-11 15:35:44 +110054#include <linux/security.h>
David Chinner3ed65262007-11-23 16:29:25 +110055#include <linux/falloc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Nathan Scott4aeb6642005-11-02 11:43:58 +110057/*
Christoph Hellwig42fe2b12006-01-11 15:35:17 +110058 * Bring the atime in the XFS inode uptodate.
59 * Used before logging the inode to disk or when the Linux inode goes away.
60 */
61void
62xfs_synchronize_atime(
63 xfs_inode_t *ip)
64{
Christoph Hellwigaf048192008-03-06 13:46:43 +110065 struct inode *inode = ip->i_vnode;
Christoph Hellwig42fe2b12006-01-11 15:35:17 +110066
Christoph Hellwigaf048192008-03-06 13:46:43 +110067 if (inode) {
68 ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec;
69 ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec;
Christoph Hellwig42fe2b12006-01-11 15:35:17 +110070 }
71}
72
73/*
David Chinner5d51eff2007-11-23 16:29:18 +110074 * If the linux inode exists, mark it dirty.
75 * Used when commiting a dirty inode into a transaction so that
76 * the inode will get written back by the linux code
77 */
78void
79xfs_mark_inode_dirty_sync(
80 xfs_inode_t *ip)
81{
Christoph Hellwigaf048192008-03-06 13:46:43 +110082 struct inode *inode = ip->i_vnode;
David Chinner5d51eff2007-11-23 16:29:18 +110083
Christoph Hellwigaf048192008-03-06 13:46:43 +110084 if (inode)
85 mark_inode_dirty_sync(inode);
David Chinner5d51eff2007-11-23 16:29:18 +110086}
87
88/*
Nathan Scott4aeb6642005-11-02 11:43:58 +110089 * Change the requested timestamp in the given inode.
90 * We don't lock across timestamp updates, and we don't log them but
91 * we do record the fact that there is dirty information in core.
92 *
93 * NOTE -- callers MUST combine XFS_ICHGTIME_MOD or XFS_ICHGTIME_CHG
94 * with XFS_ICHGTIME_ACC to be sure that access time
95 * update will take. Calling first with XFS_ICHGTIME_ACC
96 * and then XFS_ICHGTIME_MOD may fail to modify the access
97 * timestamp if the filesystem is mounted noacctm.
98 */
99void
100xfs_ichgtime(
101 xfs_inode_t *ip,
102 int flags)
103{
Nathan Scottec86dc02006-03-17 17:25:36 +1100104 struct inode *inode = vn_to_inode(XFS_ITOV(ip));
Nathan Scott4aeb6642005-11-02 11:43:58 +1100105 timespec_t tv;
106
Nathan Scott4aeb6642005-11-02 11:43:58 +1100107 nanotime(&tv);
108 if (flags & XFS_ICHGTIME_MOD) {
109 inode->i_mtime = tv;
110 ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
111 ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
112 }
113 if (flags & XFS_ICHGTIME_ACC) {
114 inode->i_atime = tv;
115 ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec;
116 ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec;
117 }
118 if (flags & XFS_ICHGTIME_CHG) {
119 inode->i_ctime = tv;
120 ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec;
121 ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec;
122 }
123
124 /*
125 * We update the i_update_core field _after_ changing
126 * the timestamps in order to coordinate properly with
127 * xfs_iflush() so that we don't lose timestamp updates.
128 * This keeps us from having to hold the inode lock
129 * while doing this. We use the SYNCHRONIZE macro to
130 * ensure that the compiler does not reorder the update
131 * of i_update_core above the timestamp updates above.
132 */
133 SYNCHRONIZE();
134 ip->i_update_core = 1;
David Chinnercf10e822007-12-07 14:09:11 +1100135 if (!(inode->i_state & I_NEW))
Nathan Scott4aeb6642005-11-02 11:43:58 +1100136 mark_inode_dirty_sync(inode);
137}
138
139/*
140 * Variant on the above which avoids querying the system clock
141 * in situations where we know the Linux inode timestamps have
142 * just been updated (and so we can update our inode cheaply).
Nathan Scott4aeb6642005-11-02 11:43:58 +1100143 */
144void
145xfs_ichgtime_fast(
146 xfs_inode_t *ip,
147 struct inode *inode,
148 int flags)
149{
150 timespec_t *tvp;
151
152 /*
Christoph Hellwig42fe2b12006-01-11 15:35:17 +1100153 * Atime updates for read() & friends are handled lazily now, and
154 * explicit updates must go through xfs_ichgtime()
155 */
156 ASSERT((flags & XFS_ICHGTIME_ACC) == 0);
157
158 /*
Nathan Scott4aeb6642005-11-02 11:43:58 +1100159 * We're not supposed to change timestamps in readonly-mounted
160 * filesystems. Throw it away if anyone asks us.
161 */
162 if (unlikely(IS_RDONLY(inode)))
163 return;
164
Nathan Scott4aeb6642005-11-02 11:43:58 +1100165 if (flags & XFS_ICHGTIME_MOD) {
166 tvp = &inode->i_mtime;
167 ip->i_d.di_mtime.t_sec = (__int32_t)tvp->tv_sec;
168 ip->i_d.di_mtime.t_nsec = (__int32_t)tvp->tv_nsec;
169 }
Nathan Scott4aeb6642005-11-02 11:43:58 +1100170 if (flags & XFS_ICHGTIME_CHG) {
171 tvp = &inode->i_ctime;
172 ip->i_d.di_ctime.t_sec = (__int32_t)tvp->tv_sec;
173 ip->i_d.di_ctime.t_nsec = (__int32_t)tvp->tv_nsec;
174 }
175
176 /*
177 * We update the i_update_core field _after_ changing
178 * the timestamps in order to coordinate properly with
179 * xfs_iflush() so that we don't lose timestamp updates.
180 * This keeps us from having to hold the inode lock
181 * while doing this. We use the SYNCHRONIZE macro to
182 * ensure that the compiler does not reorder the update
183 * of i_update_core above the timestamp updates above.
184 */
185 SYNCHRONIZE();
186 ip->i_update_core = 1;
David Chinnercf10e822007-12-07 14:09:11 +1100187 if (!(inode->i_state & I_NEW))
Nathan Scott4aeb6642005-11-02 11:43:58 +1100188 mark_inode_dirty_sync(inode);
189}
190
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
192/*
193 * Pull the link count and size up from the xfs inode to the linux inode
194 */
195STATIC void
Nathan Scott416c6d52006-03-14 14:00:51 +1100196xfs_validate_fields(
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000197 struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198{
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000199 struct xfs_inode *ip = XFS_I(inode);
200 loff_t size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000202 /* we're under i_sem so i_size can't change under us */
203 size = XFS_ISIZE(ip);
204 if (i_size_read(inode) != size)
205 i_size_write(inode, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206}
207
208/*
Nathan Scott446ada42006-01-11 15:35:44 +1100209 * Hook in SELinux. This is not quite correct yet, what we really need
210 * here (as we do for default ACLs) is a mechanism by which creation of
211 * these attrs can be journalled at inode creation time (along with the
212 * inode, of course, such that log replay can't cause these to be lost).
213 */
214STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100215xfs_init_security(
Christoph Hellwigaf048192008-03-06 13:46:43 +1100216 struct inode *inode,
Nathan Scott446ada42006-01-11 15:35:44 +1100217 struct inode *dir)
218{
Christoph Hellwigaf048192008-03-06 13:46:43 +1100219 struct xfs_inode *ip = XFS_I(inode);
Nathan Scott446ada42006-01-11 15:35:44 +1100220 size_t length;
221 void *value;
222 char *name;
223 int error;
224
Christoph Hellwigaf048192008-03-06 13:46:43 +1100225 error = security_inode_init_security(inode, dir, &name,
226 &value, &length);
Nathan Scott446ada42006-01-11 15:35:44 +1100227 if (error) {
228 if (error == -EOPNOTSUPP)
229 return 0;
230 return -error;
231 }
232
Christoph Hellwigaf048192008-03-06 13:46:43 +1100233 error = xfs_attr_set(ip, name, value, length, ATTR_SECURE);
Nathan Scott446ada42006-01-11 15:35:44 +1100234 if (!error)
Christoph Hellwigaf048192008-03-06 13:46:43 +1100235 xfs_iflags_set(ip, XFS_IMODIFIED);
Nathan Scott446ada42006-01-11 15:35:44 +1100236
237 kfree(name);
238 kfree(value);
239 return error;
240}
241
Barry Naujok556b8b12008-04-10 12:22:07 +1000242static void
243xfs_dentry_to_name(
244 struct xfs_name *namep,
245 struct dentry *dentry)
246{
247 namep->name = dentry->d_name.name;
248 namep->len = dentry->d_name.len;
249}
250
David Chinner7989cb82007-02-10 18:34:56 +1100251STATIC void
Nathan Scott416c6d52006-03-14 14:00:51 +1100252xfs_cleanup_inode(
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000253 struct inode *dir,
Christoph Hellwigaf048192008-03-06 13:46:43 +1100254 struct inode *inode,
Nathan Scott220b5282006-03-14 13:33:36 +1100255 struct dentry *dentry,
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100256 int mode)
257{
Barry Naujok556b8b12008-04-10 12:22:07 +1000258 struct xfs_name teardown;
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100259
260 /* Oh, the horror.
Nathan Scott220b5282006-03-14 13:33:36 +1100261 * If we can't add the ACL or we fail in
Nathan Scott416c6d52006-03-14 14:00:51 +1100262 * xfs_init_security we must back out.
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100263 * ENOSPC can hit here, among other things.
264 */
Barry Naujok556b8b12008-04-10 12:22:07 +1000265 xfs_dentry_to_name(&teardown, dentry);
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100266
267 if (S_ISDIR(mode))
Barry Naujok556b8b12008-04-10 12:22:07 +1000268 xfs_rmdir(XFS_I(dir), &teardown, XFS_I(inode));
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100269 else
Barry Naujok556b8b12008-04-10 12:22:07 +1000270 xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
Christoph Hellwigaf048192008-03-06 13:46:43 +1100271 iput(inode);
Yingping Lu3a69c7d2006-02-01 12:14:34 +1100272}
273
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100275xfs_vn_mknod(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 struct inode *dir,
277 struct dentry *dentry,
278 int mode,
279 dev_t rdev)
280{
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100281 struct inode *inode;
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100282 struct xfs_inode *ip = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 xfs_acl_t *default_acl = NULL;
Barry Naujok556b8b12008-04-10 12:22:07 +1000284 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
286 int error;
287
288 /*
289 * Irix uses Missed'em'V split, but doesn't want to see
290 * the upper 5 bits of (14bit) major.
291 */
Nathan Scott220b5282006-03-14 13:33:36 +1100292 if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 return -EINVAL;
294
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100295 if (test_default_acl && test_default_acl(dir)) {
Nathan Scott220b5282006-03-14 13:33:36 +1100296 if (!_ACL_ALLOC(default_acl)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297 return -ENOMEM;
Nathan Scott220b5282006-03-14 13:33:36 +1100298 }
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100299 if (!_ACL_GET_DEFAULT(dir, default_acl)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 _ACL_FREE(default_acl);
301 default_acl = NULL;
302 }
303 }
304
Barry Naujok556b8b12008-04-10 12:22:07 +1000305 xfs_dentry_to_name(&name, dentry);
306
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100307 if (IS_POSIXACL(dir) && !default_acl)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 mode &= ~current->fs->umask;
309
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 switch (mode & S_IFMT) {
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100311 case S_IFCHR:
312 case S_IFBLK:
313 case S_IFIFO:
314 case S_IFSOCK:
Christoph Hellwig3e5daf02007-10-11 18:09:12 +1000315 rdev = sysv_encode_dev(rdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 case S_IFREG:
Barry Naujok556b8b12008-04-10 12:22:07 +1000317 error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 break;
319 case S_IFDIR:
Barry Naujok556b8b12008-04-10 12:22:07 +1000320 error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 break;
322 default:
323 error = EINVAL;
324 break;
325 }
326
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100327 if (unlikely(error))
328 goto out_free_acl;
Nathan Scott446ada42006-01-11 15:35:44 +1100329
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100330 inode = ip->i_vnode;
331
332 error = xfs_init_security(inode, dir);
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100333 if (unlikely(error))
334 goto out_cleanup_inode;
335
336 if (default_acl) {
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100337 error = _ACL_INHERIT(inode, mode, default_acl);
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100338 if (unlikely(error))
339 goto out_cleanup_inode;
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100340 xfs_iflags_set(ip, XFS_IMODIFIED);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 _ACL_FREE(default_acl);
342 }
343
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100345 if (S_ISDIR(mode))
346 xfs_validate_fields(inode);
347 d_instantiate(dentry, inode);
348 xfs_validate_fields(dir);
349 return -error;
350
351 out_cleanup_inode:
Christoph Hellwig979ebab2008-03-06 13:46:05 +1100352 xfs_cleanup_inode(dir, inode, dentry, mode);
Christoph Hellwigdb0bb7b2008-03-06 13:44:35 +1100353 out_free_acl:
354 if (default_acl)
355 _ACL_FREE(default_acl);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 return -error;
357}
358
359STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100360xfs_vn_create(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 struct inode *dir,
362 struct dentry *dentry,
363 int mode,
364 struct nameidata *nd)
365{
Nathan Scott416c6d52006-03-14 14:00:51 +1100366 return xfs_vn_mknod(dir, dentry, mode, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367}
368
369STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100370xfs_vn_mkdir(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 struct inode *dir,
372 struct dentry *dentry,
373 int mode)
374{
Nathan Scott416c6d52006-03-14 14:00:51 +1100375 return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376}
377
378STATIC struct dentry *
Nathan Scott416c6d52006-03-14 14:00:51 +1100379xfs_vn_lookup(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 struct inode *dir,
381 struct dentry *dentry,
382 struct nameidata *nd)
383{
Christoph Hellwigef1f5e72008-03-06 13:46:25 +1100384 struct xfs_inode *cip;
Barry Naujok556b8b12008-04-10 12:22:07 +1000385 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 int error;
387
388 if (dentry->d_name.len >= MAXNAMELEN)
389 return ERR_PTR(-ENAMETOOLONG);
390
Barry Naujok556b8b12008-04-10 12:22:07 +1000391 xfs_dentry_to_name(&name, dentry);
392 error = xfs_lookup(XFS_I(dir), &name, &cip);
Nathan Scott67fcaa72006-06-09 17:00:52 +1000393 if (unlikely(error)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 if (unlikely(error != ENOENT))
395 return ERR_PTR(-error);
396 d_add(dentry, NULL);
397 return NULL;
398 }
399
Christoph Hellwigef1f5e72008-03-06 13:46:25 +1100400 return d_splice_alias(cip->i_vnode, dentry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401}
402
403STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100404xfs_vn_link(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 struct dentry *old_dentry,
406 struct inode *dir,
407 struct dentry *dentry)
408{
Christoph Hellwiga3da7892008-03-06 13:46:12 +1100409 struct inode *inode; /* inode of guy being linked to */
Barry Naujok556b8b12008-04-10 12:22:07 +1000410 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 int error;
412
Christoph Hellwiga3da7892008-03-06 13:46:12 +1100413 inode = old_dentry->d_inode;
Barry Naujok556b8b12008-04-10 12:22:07 +1000414 xfs_dentry_to_name(&name, dentry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415
Christoph Hellwiga3da7892008-03-06 13:46:12 +1100416 igrab(inode);
Barry Naujok556b8b12008-04-10 12:22:07 +1000417 error = xfs_link(XFS_I(dir), XFS_I(inode), &name);
Nathan Scott97dfd702006-06-27 16:13:46 +1000418 if (unlikely(error)) {
Christoph Hellwiga3da7892008-03-06 13:46:12 +1100419 iput(inode);
420 return -error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 }
Christoph Hellwiga3da7892008-03-06 13:46:12 +1100422
423 xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
424 xfs_validate_fields(inode);
425 d_instantiate(dentry, inode);
426 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427}
428
429STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100430xfs_vn_unlink(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 struct inode *dir,
432 struct dentry *dentry)
433{
434 struct inode *inode;
Barry Naujok556b8b12008-04-10 12:22:07 +1000435 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 int error;
437
438 inode = dentry->d_inode;
Barry Naujok556b8b12008-04-10 12:22:07 +1000439 xfs_dentry_to_name(&name, dentry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440
Barry Naujok556b8b12008-04-10 12:22:07 +1000441 error = xfs_remove(XFS_I(dir), &name, XFS_I(inode));
Nathan Scott220b5282006-03-14 13:33:36 +1100442 if (likely(!error)) {
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000443 xfs_validate_fields(dir); /* size needs update */
444 xfs_validate_fields(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 return -error;
447}
448
449STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100450xfs_vn_symlink(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 struct inode *dir,
452 struct dentry *dentry,
453 const char *symname)
454{
Christoph Hellwig3937be52008-03-06 13:46:19 +1100455 struct inode *inode;
456 struct xfs_inode *cip = NULL;
Barry Naujok556b8b12008-04-10 12:22:07 +1000457 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 int error;
Christoph Hellwig3e5daf02007-10-11 18:09:12 +1000459 mode_t mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460
Christoph Hellwig3e5daf02007-10-11 18:09:12 +1000461 mode = S_IFLNK |
Christoph Hellwig0432dab2005-09-02 16:46:51 +1000462 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
Barry Naujok556b8b12008-04-10 12:22:07 +1000463 xfs_dentry_to_name(&name, dentry);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464
Barry Naujok556b8b12008-04-10 12:22:07 +1000465 error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL);
Christoph Hellwig3937be52008-03-06 13:46:19 +1100466 if (unlikely(error))
467 goto out;
468
469 inode = cip->i_vnode;
470
471 error = xfs_init_security(inode, dir);
472 if (unlikely(error))
473 goto out_cleanup_inode;
474
475 d_instantiate(dentry, inode);
476 xfs_validate_fields(dir);
477 xfs_validate_fields(inode);
478 return 0;
479
480 out_cleanup_inode:
481 xfs_cleanup_inode(dir, inode, dentry, 0);
482 out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 return -error;
484}
485
486STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100487xfs_vn_rmdir(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 struct inode *dir,
489 struct dentry *dentry)
490{
491 struct inode *inode = dentry->d_inode;
Barry Naujok556b8b12008-04-10 12:22:07 +1000492 struct xfs_name name;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 int error;
494
Barry Naujok556b8b12008-04-10 12:22:07 +1000495 xfs_dentry_to_name(&name, dentry);
496
497 error = xfs_rmdir(XFS_I(dir), &name, XFS_I(inode));
Nathan Scott220b5282006-03-14 13:33:36 +1100498 if (likely(!error)) {
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000499 xfs_validate_fields(inode);
500 xfs_validate_fields(dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 }
502 return -error;
503}
504
505STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100506xfs_vn_rename(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 struct inode *odir,
508 struct dentry *odentry,
509 struct inode *ndir,
510 struct dentry *ndentry)
511{
512 struct inode *new_inode = ndentry->d_inode;
Barry Naujok556b8b12008-04-10 12:22:07 +1000513 struct xfs_name oname;
514 struct xfs_name nname;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 int error;
516
Barry Naujok556b8b12008-04-10 12:22:07 +1000517 xfs_dentry_to_name(&oname, odentry);
518 xfs_dentry_to_name(&nname, ndentry);
519
520 error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
521 XFS_I(ndir), &nname);
Nathan Scott220b5282006-03-14 13:33:36 +1100522 if (likely(!error)) {
523 if (new_inode)
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000524 xfs_validate_fields(new_inode);
525 xfs_validate_fields(odir);
Nathan Scott220b5282006-03-14 13:33:36 +1100526 if (ndir != odir)
Christoph Hellwig6572bc22007-09-19 15:27:39 +1000527 xfs_validate_fields(ndir);
Nathan Scott220b5282006-03-14 13:33:36 +1100528 }
Nathan Scott220b5282006-03-14 13:33:36 +1100529 return -error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530}
531
532/*
533 * careful here - this function can get called recursively, so
534 * we need to be very careful about how much stack we use.
535 * uio is kmalloced for this reason...
536 */
Al Viro008b1502005-08-20 00:17:39 +0100537STATIC void *
Nathan Scott416c6d52006-03-14 14:00:51 +1100538xfs_vn_follow_link(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 struct dentry *dentry,
540 struct nameidata *nd)
541{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 char *link;
Christoph Hellwig804c83c2007-08-28 13:59:03 +1000543 int error = -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544
Panagiotis Issarisf52720c2006-09-27 01:49:39 -0700545 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
Christoph Hellwig804c83c2007-08-28 13:59:03 +1000546 if (!link)
547 goto out_err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000549 error = -xfs_readlink(XFS_I(dentry->d_inode), link);
Christoph Hellwig804c83c2007-08-28 13:59:03 +1000550 if (unlikely(error))
551 goto out_kfree;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552
553 nd_set_link(nd, link);
Al Viro008b1502005-08-20 00:17:39 +0100554 return NULL;
Christoph Hellwig804c83c2007-08-28 13:59:03 +1000555
556 out_kfree:
557 kfree(link);
558 out_err:
559 nd_set_link(nd, ERR_PTR(error));
560 return NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561}
562
Nathan Scottcde410a2005-09-05 11:47:01 +1000563STATIC void
Nathan Scott416c6d52006-03-14 14:00:51 +1100564xfs_vn_put_link(
Nathan Scottcde410a2005-09-05 11:47:01 +1000565 struct dentry *dentry,
566 struct nameidata *nd,
567 void *p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568{
Nathan Scottcde410a2005-09-05 11:47:01 +1000569 char *s = nd_get_link(nd);
570
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 if (!IS_ERR(s))
572 kfree(s);
573}
574
575#ifdef CONFIG_XFS_POSIX_ACL
576STATIC int
Christoph Hellwig45767582008-02-05 12:13:24 +1100577xfs_check_acl(
578 struct inode *inode,
579 int mask)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580{
Christoph Hellwig45767582008-02-05 12:13:24 +1100581 struct xfs_inode *ip = XFS_I(inode);
582 int error;
583
584 xfs_itrace_entry(ip);
585
586 if (XFS_IFORK_Q(ip)) {
587 error = xfs_acl_iaccess(ip, mask, NULL);
588 if (error != -1)
589 return -error;
590 }
591
592 return -EAGAIN;
593}
594
595STATIC int
596xfs_vn_permission(
597 struct inode *inode,
598 int mask,
599 struct nameidata *nd)
600{
601 return generic_permission(inode, mask, xfs_check_acl);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602}
603#else
Nathan Scott416c6d52006-03-14 14:00:51 +1100604#define xfs_vn_permission NULL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605#endif
606
607STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100608xfs_vn_getattr(
Christoph Hellwigc43f4082007-10-11 17:46:39 +1000609 struct vfsmount *mnt,
610 struct dentry *dentry,
611 struct kstat *stat)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612{
Christoph Hellwigc43f4082007-10-11 17:46:39 +1000613 struct inode *inode = dentry->d_inode;
614 struct xfs_inode *ip = XFS_I(inode);
615 struct xfs_mount *mp = ip->i_mount;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616
Christoph Hellwigc43f4082007-10-11 17:46:39 +1000617 xfs_itrace_entry(ip);
618
619 if (XFS_FORCED_SHUTDOWN(mp))
620 return XFS_ERROR(EIO);
621
622 stat->size = XFS_ISIZE(ip);
623 stat->dev = inode->i_sb->s_dev;
624 stat->mode = ip->i_d.di_mode;
625 stat->nlink = ip->i_d.di_nlink;
626 stat->uid = ip->i_d.di_uid;
627 stat->gid = ip->i_d.di_gid;
628 stat->ino = ip->i_ino;
629#if XFS_BIG_INUMS
630 stat->ino += mp->m_inoadd;
631#endif
632 stat->atime = inode->i_atime;
633 stat->mtime.tv_sec = ip->i_d.di_mtime.t_sec;
634 stat->mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
635 stat->ctime.tv_sec = ip->i_d.di_ctime.t_sec;
636 stat->ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
637 stat->blocks =
638 XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
639
640
641 switch (inode->i_mode & S_IFMT) {
642 case S_IFBLK:
643 case S_IFCHR:
644 stat->blksize = BLKDEV_IOSIZE;
645 stat->rdev = MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff,
646 sysv_minor(ip->i_df.if_u2.if_rdev));
647 break;
648 default:
Eric Sandeen71ddabb2007-11-23 16:29:42 +1100649 if (XFS_IS_REALTIME_INODE(ip)) {
Christoph Hellwigc43f4082007-10-11 17:46:39 +1000650 /*
651 * If the file blocks are being allocated from a
652 * realtime volume, then return the inode's realtime
653 * extent size or the realtime volume's extent size.
654 */
655 stat->blksize =
656 xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
657 } else
658 stat->blksize = xfs_preferred_iosize(mp);
659 stat->rdev = 0;
660 break;
Nathan Scott69e23b92006-09-28 11:01:22 +1000661 }
Christoph Hellwigc43f4082007-10-11 17:46:39 +1000662
663 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664}
665
666STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100667xfs_vn_setattr(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 struct dentry *dentry,
669 struct iattr *attr)
670{
671 struct inode *inode = dentry->d_inode;
672 unsigned int ia_valid = attr->ia_valid;
Nathan Scott8285fb52006-06-09 17:07:12 +1000673 bhv_vattr_t vattr = { 0 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 int flags = 0;
675 int error;
676
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 if (ia_valid & ATTR_UID) {
678 vattr.va_mask |= XFS_AT_UID;
679 vattr.va_uid = attr->ia_uid;
680 }
681 if (ia_valid & ATTR_GID) {
682 vattr.va_mask |= XFS_AT_GID;
683 vattr.va_gid = attr->ia_gid;
684 }
685 if (ia_valid & ATTR_SIZE) {
686 vattr.va_mask |= XFS_AT_SIZE;
687 vattr.va_size = attr->ia_size;
688 }
689 if (ia_valid & ATTR_ATIME) {
690 vattr.va_mask |= XFS_AT_ATIME;
691 vattr.va_atime = attr->ia_atime;
Nathan Scott8c0b5112006-04-11 15:12:45 +1000692 inode->i_atime = attr->ia_atime;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 }
694 if (ia_valid & ATTR_MTIME) {
695 vattr.va_mask |= XFS_AT_MTIME;
696 vattr.va_mtime = attr->ia_mtime;
697 }
698 if (ia_valid & ATTR_CTIME) {
699 vattr.va_mask |= XFS_AT_CTIME;
700 vattr.va_ctime = attr->ia_ctime;
701 }
702 if (ia_valid & ATTR_MODE) {
703 vattr.va_mask |= XFS_AT_MODE;
704 vattr.va_mode = attr->ia_mode;
705 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
706 inode->i_mode &= ~S_ISGID;
707 }
708
709 if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))
710 flags |= ATTR_UTIME;
711#ifdef ATTR_NO_BLOCK
712 if ((ia_valid & ATTR_NO_BLOCK))
713 flags |= ATTR_NONBLOCK;
714#endif
715
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000716 error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL);
Nathan Scott220b5282006-03-14 13:33:36 +1100717 if (likely(!error))
Christoph Hellwig21a62542007-09-19 15:27:49 +1000718 vn_revalidate(vn_from_inode(inode));
Nathan Scott220b5282006-03-14 13:33:36 +1100719 return -error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720}
721
David Chinnerd87dd632008-04-10 12:21:46 +1000722/*
723 * block_truncate_page can return an error, but we can't propagate it
724 * at all here. Leave a complaint + stack trace in the syslog because
725 * this could be bad. If it is bad, we need to propagate the error further.
726 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727STATIC void
Nathan Scott416c6d52006-03-14 14:00:51 +1100728xfs_vn_truncate(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 struct inode *inode)
730{
David Chinnerd87dd632008-04-10 12:21:46 +1000731 int error;
732 error = block_truncate_page(inode->i_mapping, inode->i_size,
733 xfs_get_blocks);
734 WARN_ON(error);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735}
736
737STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100738xfs_vn_setxattr(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 struct dentry *dentry,
740 const char *name,
741 const void *data,
742 size_t size,
743 int flags)
744{
Nathan Scott67fcaa72006-06-09 17:00:52 +1000745 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746 char *attr = (char *)name;
747 attrnames_t *namesp;
748 int xflags = 0;
749 int error;
750
751 namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
752 if (!namesp)
753 return -EOPNOTSUPP;
754 attr += namesp->attr_namelen;
755 error = namesp->attr_capable(vp, NULL);
756 if (error)
757 return error;
758
759 /* Convert Linux syscall to XFS internal ATTR flags */
760 if (flags & XATTR_CREATE)
761 xflags |= ATTR_CREATE;
762 if (flags & XATTR_REPLACE)
763 xflags |= ATTR_REPLACE;
764 xflags |= namesp->attr_flag;
765 return namesp->attr_set(vp, attr, (void *)data, size, xflags);
766}
767
768STATIC ssize_t
Nathan Scott416c6d52006-03-14 14:00:51 +1100769xfs_vn_getxattr(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 struct dentry *dentry,
771 const char *name,
772 void *data,
773 size_t size)
774{
Nathan Scott67fcaa72006-06-09 17:00:52 +1000775 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 char *attr = (char *)name;
777 attrnames_t *namesp;
778 int xflags = 0;
779 ssize_t error;
780
781 namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
782 if (!namesp)
783 return -EOPNOTSUPP;
784 attr += namesp->attr_namelen;
785 error = namesp->attr_capable(vp, NULL);
786 if (error)
787 return error;
788
789 /* Convert Linux syscall to XFS internal ATTR flags */
790 if (!size) {
791 xflags |= ATTR_KERNOVAL;
792 data = NULL;
793 }
794 xflags |= namesp->attr_flag;
795 return namesp->attr_get(vp, attr, (void *)data, size, xflags);
796}
797
798STATIC ssize_t
Nathan Scott416c6d52006-03-14 14:00:51 +1100799xfs_vn_listxattr(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 struct dentry *dentry,
801 char *data,
802 size_t size)
803{
Nathan Scott67fcaa72006-06-09 17:00:52 +1000804 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 int error, xflags = ATTR_KERNAMELS;
806 ssize_t result;
807
808 if (!size)
809 xflags |= ATTR_KERNOVAL;
810 xflags |= capable(CAP_SYS_ADMIN) ? ATTR_KERNFULLS : ATTR_KERNORMALS;
811
812 error = attr_generic_list(vp, data, size, xflags, &result);
813 if (error < 0)
814 return error;
815 return result;
816}
817
818STATIC int
Nathan Scott416c6d52006-03-14 14:00:51 +1100819xfs_vn_removexattr(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 struct dentry *dentry,
821 const char *name)
822{
Nathan Scott67fcaa72006-06-09 17:00:52 +1000823 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824 char *attr = (char *)name;
825 attrnames_t *namesp;
826 int xflags = 0;
827 int error;
828
829 namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
830 if (!namesp)
831 return -EOPNOTSUPP;
832 attr += namesp->attr_namelen;
833 error = namesp->attr_capable(vp, NULL);
834 if (error)
835 return error;
836 xflags |= namesp->attr_flag;
837 return namesp->attr_remove(vp, attr, xflags);
838}
839
David Chinner3ed65262007-11-23 16:29:25 +1100840STATIC long
841xfs_vn_fallocate(
842 struct inode *inode,
843 int mode,
844 loff_t offset,
845 loff_t len)
846{
847 long error;
848 loff_t new_size = 0;
849 xfs_flock64_t bf;
850 xfs_inode_t *ip = XFS_I(inode);
851
852 /* preallocation on directories not yet supported */
853 error = -ENODEV;
854 if (S_ISDIR(inode->i_mode))
855 goto out_error;
856
857 bf.l_whence = 0;
858 bf.l_start = offset;
859 bf.l_len = len;
860
861 xfs_ilock(ip, XFS_IOLOCK_EXCL);
862 error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
863 0, NULL, ATTR_NOLOCK);
864 if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
865 offset + len > i_size_read(inode))
866 new_size = offset + len;
867
868 /* Change file size if needed */
869 if (new_size) {
870 bhv_vattr_t va;
871
872 va.va_mask = XFS_AT_SIZE;
873 va.va_size = new_size;
874 error = xfs_setattr(ip, &va, ATTR_NOLOCK, NULL);
875 }
876
877 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
878out_error:
879 return error;
880}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800882const struct inode_operations xfs_inode_operations = {
Nathan Scott416c6d52006-03-14 14:00:51 +1100883 .permission = xfs_vn_permission,
884 .truncate = xfs_vn_truncate,
885 .getattr = xfs_vn_getattr,
886 .setattr = xfs_vn_setattr,
887 .setxattr = xfs_vn_setxattr,
888 .getxattr = xfs_vn_getxattr,
889 .listxattr = xfs_vn_listxattr,
890 .removexattr = xfs_vn_removexattr,
David Chinner3ed65262007-11-23 16:29:25 +1100891 .fallocate = xfs_vn_fallocate,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892};
893
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800894const struct inode_operations xfs_dir_inode_operations = {
Nathan Scott416c6d52006-03-14 14:00:51 +1100895 .create = xfs_vn_create,
896 .lookup = xfs_vn_lookup,
897 .link = xfs_vn_link,
898 .unlink = xfs_vn_unlink,
899 .symlink = xfs_vn_symlink,
900 .mkdir = xfs_vn_mkdir,
901 .rmdir = xfs_vn_rmdir,
902 .mknod = xfs_vn_mknod,
903 .rename = xfs_vn_rename,
904 .permission = xfs_vn_permission,
905 .getattr = xfs_vn_getattr,
906 .setattr = xfs_vn_setattr,
907 .setxattr = xfs_vn_setxattr,
908 .getxattr = xfs_vn_getxattr,
909 .listxattr = xfs_vn_listxattr,
910 .removexattr = xfs_vn_removexattr,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911};
912
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800913const struct inode_operations xfs_symlink_inode_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700914 .readlink = generic_readlink,
Nathan Scott416c6d52006-03-14 14:00:51 +1100915 .follow_link = xfs_vn_follow_link,
916 .put_link = xfs_vn_put_link,
917 .permission = xfs_vn_permission,
918 .getattr = xfs_vn_getattr,
919 .setattr = xfs_vn_setattr,
920 .setxattr = xfs_vn_setxattr,
921 .getxattr = xfs_vn_getxattr,
922 .listxattr = xfs_vn_listxattr,
923 .removexattr = xfs_vn_removexattr,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924};