inode.c (d81645510ce2a140816c4cb37c45b78d810ca63f) inode.c (b134d687dd9369bb2407a23c6ecc9e0a15d8bb20)
1/*
2 * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
3 *
4 * This software may be freely redistributed under the terms of the
5 * GNU General Public License.
6 *
7 * You should have received a copy of the GNU General Public License
8 * along with this program; if not, write to the Free Software

--- 15 unchanged lines hidden (view full) ---

24#include <linux/iversion.h>
25#include "internal.h"
26
27static const struct inode_operations afs_symlink_inode_operations = {
28 .get_link = page_get_link,
29 .listxattr = afs_listxattr,
30};
31
1/*
2 * Copyright (c) 2002 Red Hat, Inc. All rights reserved.
3 *
4 * This software may be freely redistributed under the terms of the
5 * GNU General Public License.
6 *
7 * You should have received a copy of the GNU General Public License
8 * along with this program; if not, write to the Free Software

--- 15 unchanged lines hidden (view full) ---

24#include <linux/iversion.h>
25#include "internal.h"
26
27static const struct inode_operations afs_symlink_inode_operations = {
28 .get_link = page_get_link,
29 .listxattr = afs_listxattr,
30};
31
32static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
33{
34 static unsigned long once_only;
35
36 pr_warn("kAFS: AFS vnode with undefined type %u\n",
37 vnode->status.type);
38 pr_warn("kAFS: A=%d m=%o s=%llx v=%llx\n",
39 vnode->status.abort_code,
40 vnode->status.mode,
41 vnode->status.size,
42 vnode->status.data_version);
43 pr_warn("kAFS: vnode %llx:%llx:%x\n",
44 vnode->fid.vid,
45 vnode->fid.vnode,
46 vnode->fid.unique);
47 if (parent_vnode)
48 pr_warn("kAFS: dir %llx:%llx:%x\n",
49 parent_vnode->fid.vid,
50 parent_vnode->fid.vnode,
51 parent_vnode->fid.unique);
52
53 if (!test_and_set_bit(0, &once_only))
54 dump_stack();
55}
56
32/*
33 * Initialise an inode from the vnode status.
34 */
57/*
58 * Initialise an inode from the vnode status.
59 */
35static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key)
60static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
61 struct afs_vnode *parent_vnode)
36{
37 struct inode *inode = AFS_VNODE_TO_I(vnode);
38
39 _debug("FS: ft=%d lk=%d sz=%llu ver=%Lu mod=%hu",
40 vnode->status.type,
41 vnode->status.nlink,
42 (unsigned long long) vnode->status.size,
43 vnode->status.data_version,

--- 31 unchanged lines hidden (view full) ---

75 } else {
76 inode->i_mode = S_IFLNK | vnode->status.mode;
77 inode->i_op = &afs_symlink_inode_operations;
78 inode->i_mapping->a_ops = &afs_fs_aops;
79 }
80 inode_nohighmem(inode);
81 break;
82 default:
62{
63 struct inode *inode = AFS_VNODE_TO_I(vnode);
64
65 _debug("FS: ft=%d lk=%d sz=%llu ver=%Lu mod=%hu",
66 vnode->status.type,
67 vnode->status.nlink,
68 (unsigned long long) vnode->status.size,
69 vnode->status.data_version,

--- 31 unchanged lines hidden (view full) ---

101 } else {
102 inode->i_mode = S_IFLNK | vnode->status.mode;
103 inode->i_op = &afs_symlink_inode_operations;
104 inode->i_mapping->a_ops = &afs_fs_aops;
105 }
106 inode_nohighmem(inode);
107 break;
108 default:
83 printk("kAFS: AFS vnode with undefined type\n");
109 dump_vnode(vnode, parent_vnode);
84 read_sequnlock_excl(&vnode->cb_lock);
85 return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
86 }
87
88 inode->i_blocks = 0;
89 vnode->invalid_before = vnode->status.data_version;
90
91 read_sequnlock_excl(&vnode->cb_lock);

--- 173 unchanged lines hidden (view full) ---

265#endif
266}
267
268/*
269 * inode retrieval
270 */
271struct inode *afs_iget(struct super_block *sb, struct key *key,
272 struct afs_fid *fid, struct afs_file_status *status,
110 read_sequnlock_excl(&vnode->cb_lock);
111 return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
112 }
113
114 inode->i_blocks = 0;
115 vnode->invalid_before = vnode->status.data_version;
116
117 read_sequnlock_excl(&vnode->cb_lock);

--- 173 unchanged lines hidden (view full) ---

291#endif
292}
293
294/*
295 * inode retrieval
296 */
297struct inode *afs_iget(struct super_block *sb, struct key *key,
298 struct afs_fid *fid, struct afs_file_status *status,
273 struct afs_callback *cb, struct afs_cb_interest *cbi)
299 struct afs_callback *cb, struct afs_cb_interest *cbi,
300 struct afs_vnode *parent_vnode)
274{
275 struct afs_iget_data data = { .fid = *fid };
276 struct afs_super_info *as;
277 struct afs_vnode *vnode;
278 struct inode *inode;
279 int ret;
280
281 _enter(",{%llx:%llu.%u},,", fid->vid, fid->vnode, fid->unique);

--- 40 unchanged lines hidden (view full) ---

322 vnode->cb_expires_at = cb->expires_at;
323 vnode->cb_interest = afs_get_cb_interest(cbi);
324 set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
325 }
326
327 vnode->cb_expires_at += ktime_get_real_seconds();
328 }
329
301{
302 struct afs_iget_data data = { .fid = *fid };
303 struct afs_super_info *as;
304 struct afs_vnode *vnode;
305 struct inode *inode;
306 int ret;
307
308 _enter(",{%llx:%llu.%u},,", fid->vid, fid->vnode, fid->unique);

--- 40 unchanged lines hidden (view full) ---

349 vnode->cb_expires_at = cb->expires_at;
350 vnode->cb_interest = afs_get_cb_interest(cbi);
351 set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
352 }
353
354 vnode->cb_expires_at += ktime_get_real_seconds();
355 }
356
330 ret = afs_inode_init_from_status(vnode, key);
357 ret = afs_inode_init_from_status(vnode, key, parent_vnode);
331 if (ret < 0)
332 goto bad_inode;
333
334 afs_get_inode_cache(vnode);
335
336 /* success */
337 clear_bit(AFS_VNODE_UNSET, &vnode->flags);
338 inode->i_flags |= S_NOATIME;

--- 199 unchanged lines hidden (view full) ---

538 aux.data_version = vnode->status.data_version;
539 fscache_relinquish_cookie(vnode->cache, &aux,
540 test_bit(AFS_VNODE_DELETED, &vnode->flags));
541 vnode->cache = NULL;
542 }
543#endif
544
545 afs_put_permits(rcu_access_pointer(vnode->permit_cache));
358 if (ret < 0)
359 goto bad_inode;
360
361 afs_get_inode_cache(vnode);
362
363 /* success */
364 clear_bit(AFS_VNODE_UNSET, &vnode->flags);
365 inode->i_flags |= S_NOATIME;

--- 199 unchanged lines hidden (view full) ---

565 aux.data_version = vnode->status.data_version;
566 fscache_relinquish_cookie(vnode->cache, &aux,
567 test_bit(AFS_VNODE_DELETED, &vnode->flags));
568 vnode->cache = NULL;
569 }
570#endif
571
572 afs_put_permits(rcu_access_pointer(vnode->permit_cache));
573 key_put(vnode->silly_key);
574 vnode->silly_key = NULL;
546 key_put(vnode->lock_key);
547 vnode->lock_key = NULL;
548 _leave("");
549}
550
551/*
552 * set the attributes of an inode
553 */

--- 50 unchanged lines hidden ---
575 key_put(vnode->lock_key);
576 vnode->lock_key = NULL;
577 _leave("");
578}
579
580/*
581 * set the attributes of an inode
582 */

--- 50 unchanged lines hidden ---