Lines Matching defs:inode

16  *              depends only on the dcache stuff and doesn't touch the inode
53 static int nfs_opendir(struct inode *, struct file *);
54 static int nfs_closedir(struct inode *, struct file *);
76 alloc_nfs_open_dir_context(struct inode *dir)
99 static void put_nfs_open_dir_context(struct inode *dir, struct nfs_open_dir_context *ctx)
111 nfs_opendir(struct inode *inode, struct file *filp)
118 nfs_inc_stats(inode, NFSIOS_VFSOPEN);
120 ctx = alloc_nfs_open_dir_context(inode);
131 nfs_closedir(struct inode *inode, struct file *filp)
585 struct inode *inode = file_inode(desc->file);
604 desc->dir_verifier = nfs_save_change_attribute(inode);
605 error = NFS_PROTO(inode)->readdir(&arg, &res);
609 NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS;
624 struct inode *inode = file_inode(desc->file);
627 error = NFS_PROTO(inode)->decode_dirent(xdr, entry, desc->plus);
641 struct inode *inode;
647 inode = d_inode(dentry);
648 if (is_bad_inode(inode) || NFS_STALE(inode))
651 nfsi = NFS_I(inode);
661 static bool nfs_use_readdirplus(struct inode *dir, struct dir_context *ctx,
678 void nfs_readdir_record_entry_cache_hit(struct inode *dir)
697 void nfs_readdir_record_entry_cache_miss(struct inode *dir)
711 static void nfs_lookup_advise_force_readdirplus(struct inode *dir,
729 struct inode *inode;
788 inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr);
789 alias = d_splice_alias(inode, dentry);
935 struct inode *inode = file_inode(desc->file);
945 entry->fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
946 entry->server = NFS_SERVER(inode);
955 change_attr = inode_peek_iversion_raw(inode);
1013 struct inode *inode = file_inode(desc->file);
1014 struct nfs_inode *nfsi = NFS_I(inode);
1033 trace_nfs_readdir_cache_fill_done(inode, res);
1038 inode, 0, MAX_LFS_FILESIZE);
1053 inode, 1, MAX_LFS_FILESIZE);
1202 static bool nfs_readdir_handle_cache_misses(struct inode *inode,
1211 trace_nfs_readdir_force_readdirplus(inode);
1222 struct inode *inode = d_inode(dentry);
1223 struct nfs_inode *nfsi = NFS_I(inode);
1232 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS);
1240 nfs_revalidate_mapping(inode, file->f_mapping);
1268 desc->plus = nfs_use_readdirplus(inode, ctx, cache_hits, cache_misses);
1269 force_clear = nfs_readdir_handle_cache_misses(inode, desc, cache_misses,
1290 nfs_zap_caches(inode);
1378 * @dir: pointer to directory inode
1385 * was revalidated while holding a delegation on its inode.
1389 void nfs_force_lookup_revalidate(struct inode *dir)
1397 * @dir: pointer to parent directory inode
1404 static bool nfs_verify_change_attribute(struct inode *dir, unsigned long verf)
1433 struct inode *inode = d_inode(dentry);
1434 struct inode *dir = d_inode(dentry->d_parent);
1438 if (inode && NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
1448 * Saves the parent directory verifier in @dentry. If the inode has
1465 * @inode: pointer to inode
1467 * Iterates through the dentries in the inode alias list and clears
1473 void nfs_clear_verifier_delegated(struct inode *inode)
1477 if (!inode)
1479 spin_lock(&inode->i_lock);
1480 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
1485 spin_unlock(&inode->i_lock);
1490 static int nfs_dentry_verify_change(struct inode *dir, struct dentry *dentry)
1504 static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
1529 static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags)
1545 int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
1547 struct nfs_server *server = NFS_SERVER(inode);
1550 if (IS_AUTOMOUNT(inode))
1554 switch (inode->i_mode & S_IFMT) {
1572 if (inode->i_nlink > 0 ||
1573 (inode->i_nlink == 0 &&
1574 test_bit(NFS_INO_PRESERVE_UNLINKED, &NFS_I(inode)->flags)))
1581 ret = __nfs_revalidate_inode(server, inode);
1587 static void nfs_mark_dir_for_revalidate(struct inode *inode)
1589 spin_lock(&inode->i_lock);
1590 nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE);
1591 spin_unlock(&inode->i_lock);
1596 * dentries by looking at the parent inode mtime.
1608 int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
1622 nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry,
1623 struct inode *inode, int error)
1635 if (inode && IS_ROOT(dentry))
1644 nfs_lookup_revalidate_negative(struct inode *dir, struct dentry *dentry,
1657 nfs_lookup_revalidate_delegated(struct inode *dir, struct dentry *dentry,
1658 struct inode *inode)
1661 return nfs_lookup_revalidate_done(dir, dentry, inode, 1);
1664 static int nfs_lookup_revalidate_dentry(struct inode *dir,
1666 struct inode *inode, unsigned int flags)
1677 fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
1690 if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL)
1700 if (nfs_compare_fh(NFS_FH(inode), fhandle))
1702 if (nfs_refresh_inode(inode, fattr) < 0)
1705 nfs_setsecurity(inode, fattr);
1719 return nfs_lookup_revalidate_done(dir, dentry, inode, ret);
1728 * we have an inode!
1734 nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
1737 struct inode *inode;
1741 inode = d_inode(dentry);
1743 if (!inode)
1746 if (is_bad_inode(inode)) {
1747 dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
1757 return nfs_lookup_revalidate_delegated(dir, dentry, inode);
1762 error = nfs_lookup_verify_inode(inode, flags);
1774 if (NFS_STALE(inode))
1777 return nfs_lookup_revalidate_dentry(dir, dentry, inode, flags);
1779 return nfs_lookup_revalidate_done(dir, dentry, inode, 1);
1783 return nfs_lookup_revalidate_done(dir, dentry, inode, 0);
1788 int (*reval)(struct inode *, struct dentry *, unsigned int))
1791 struct inode *dir;
1826 * In this situation, we just want to verify that the inode itself is OK
1831 struct inode *inode = d_inode(dentry);
1839 if (!inode) {
1840 dfprintk(LOOKUPCACHE, "%s: %pd2 has negative inode\n",
1845 if (is_bad_inode(inode)) {
1846 dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
1851 error = nfs_lookup_verify_inode(inode, flags);
1852 dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n",
1853 __func__, inode->i_ino, error ? "invalid" : "valid");
1865 /* Unhash any dentry with a stale inode */
1882 /* Ensure that we revalidate inode->i_nlink */
1883 static void nfs_drop_nlink(struct inode *inode)
1885 spin_lock(&inode->i_lock);
1886 /* drop the inode if we're reasonably sure this is the last link */
1887 if (inode->i_nlink > 0)
1888 drop_nlink(inode);
1889 NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
1891 inode, NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME |
1893 spin_unlock(&inode->i_lock);
1897 * Called when the dentry loses inode.
1900 static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
1903 nfs_complete_unlink(dentry, inode);
1904 nfs_drop_nlink(inode);
1906 iput(inode);
1930 struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
1933 struct inode *inode = NULL;
1970 inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
1971 res = ERR_CAST(inode);
1979 res = d_splice_alias(inode, dentry);
1994 void nfs_d_prune_case_insensitive_aliases(struct inode *inode)
1997 if (inode && nfs_server_capable(inode, NFS_CAP_CASE_INSENSITIVE))
1998 d_prune_aliases(inode);
2020 static int do_open(struct inode *inode, struct file *filp)
2022 nfs_fscache_open_file(inode, filp);
2043 int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
2051 struct inode *inode;
2116 inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr, &created);
2119 if (IS_ERR(inode)) {
2120 err = PTR_ERR(inode);
2161 inode = d_inode(dentry);
2162 if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2163 !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
2165 else if (inode && S_ISREG(inode->i_mode))
2168 inode = d_inode(res);
2169 if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2170 !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
2173 } else if (inode && S_ISREG(inode->i_mode)) {
2192 nfs4_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
2195 struct inode *inode;
2202 inode = d_inode(dentry);
2207 if (inode == NULL)
2211 return nfs_lookup_revalidate_delegated(dir, dentry, inode);
2214 if (!S_ISREG(inode->i_mode))
2230 return nfs_lookup_revalidate_dentry(dir, dentry, inode, flags);
2249 struct inode *dir = d_inode(parent);
2250 struct inode *inode;
2269 inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
2270 d = d_splice_alias(inode, dentry);
2304 int nfs_create(struct mnt_idmap *idmap, struct inode *dir,
2333 nfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
2360 int nfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
2390 static void nfs_dentry_remove_handle_error(struct inode *dir,
2405 int nfs_rmdir(struct inode *dir, struct dentry *dentry)
2416 /* Ensure the VFS deletes this inode */
2438 * We invalidate the attribute cache and free the inode prior to the operation
2439 * to avoid possible races if the server reuses the inode.
2443 struct inode *dir = d_inode(dentry->d_parent);
2444 struct inode *inode = d_inode(dentry);
2456 if (inode != NULL) {
2459 nfs_drop_nlink(inode);
2469 /* We do silly rename. In case sillyrename() returns -EBUSY, the inode
2474 int nfs_unlink(struct inode *dir, struct dentry *dentry)
2486 /* Start asynchronous writeout of the inode */
2518 * To create a symbolic link, most file systems instantiate a new inode,
2522 * Unfortunately the NFS client can't create the in-core inode first
2523 * because it needs a file handle to create an in-core inode (see
2524 * fs/nfs/inode.c:nfs_fhget). We only have a file handle *after* the
2529 * now have a new file handle and can instantiate an in-core NFS inode
2532 int nfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
2594 nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
2596 struct inode *inode = d_inode(old_dentry);
2602 trace_nfs_link_enter(inode, dir, dentry);
2604 if (S_ISREG(inode->i_mode))
2605 nfs_sync_inode(inode);
2606 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
2609 ihold(inode);
2610 d_add(dentry, inode);
2612 trace_nfs_link_exit(inode, dir, dentry, error);
2629 * different file handle for the same inode after a rename (e.g. when
2633 * file in old_dir will go away when the last process iput()s the inode.
2641 * using the inode layer
2645 * rid of the old inode after the operation. This means there must be
2650 int nfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
2651 struct dentry *old_dentry, struct inode *new_dir,
2654 struct inode *old_inode = d_inode(old_dentry);
2655 struct inode *new_inode = d_inode(new_dentry);
2735 /* Ensure the inode attributes are revalidated */
2807 struct inode *inode;
2811 inode = &nfsi->vfs_inode;
2812 spin_lock(&inode->i_lock);
2830 spin_unlock(&inode->i_lock);
2886 void nfs_access_zap_cache(struct inode *inode)
2890 if (test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags) == 0)
2894 if (test_and_clear_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags))
2895 list_del_init(&NFS_I(inode)->access_cache_inode_lru);
2897 spin_lock(&inode->i_lock);
2898 __nfs_access_zap_cache(NFS_I(inode), &head);
2899 spin_unlock(&inode->i_lock);
2942 static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, const struct cred *cred)
2944 struct rb_node *n = NFS_I(inode)->access_cache.rb_node;
2981 static int nfs_access_get_cached_locked(struct inode *inode, const struct cred *cred, u32 *mask, bool may_block)
2983 struct nfs_inode *nfsi = NFS_I(inode);
2989 spin_lock(&inode->i_lock);
2993 cache = nfs_access_search_rbtree(inode, cred);
2998 if (!nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
3005 spin_unlock(&inode->i_lock);
3006 err = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
3009 spin_lock(&inode->i_lock);
3019 spin_unlock(&inode->i_lock);
3022 spin_unlock(&inode->i_lock);
3023 nfs_access_zap_cache(inode);
3027 static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cred, u32 *mask)
3032 struct nfs_inode *nfsi = NFS_I(inode);
3050 if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
3059 int nfs_access_get_cached(struct inode *inode, const struct cred *cred,
3064 status = nfs_access_get_cached_rcu(inode, cred, mask);
3066 status = nfs_access_get_cached_locked(inode, cred, mask,
3073 static void nfs_access_add_rbtree(struct inode *inode,
3077 struct nfs_inode *nfsi = NFS_I(inode);
3084 spin_lock(&inode->i_lock);
3100 spin_unlock(&inode->i_lock);
3106 spin_unlock(&inode->i_lock);
3110 void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set,
3128 nfs_access_add_rbtree(inode, cache, cred);
3135 /* Add inode to global LRU list */
3136 if (!test_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags)) {
3138 if (!test_and_set_bit(NFS_INO_ACL_LRU_SET, &NFS_I(inode)->flags))
3139 list_add_tail(&NFS_I(inode)->access_cache_inode_lru,
3184 static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask)
3191 trace_nfs_access_enter(inode);
3193 status = nfs_access_get_cached(inode, cred, &cache.mask, may_block);
3205 nfs_access_xattr_mask(NFS_SERVER(inode));
3206 if (S_ISDIR(inode->i_mode))
3210 status = NFS_PROTO(inode)->access(inode, &cache, cred);
3213 if (!S_ISDIR(inode->i_mode))
3214 nfs_set_inode_stale(inode);
3216 nfs_zap_caches(inode);
3220 nfs_access_add_cache(inode, &cache, cred);
3222 cache_mask = nfs_access_calc_mask(cache.mask, inode->i_mode);
3226 trace_nfs_access_exit(inode, mask, cache_mask, status);
3247 int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags)
3249 return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
3253 static int nfs_execute_ok(struct inode *inode, int mask)
3255 struct nfs_server *server = NFS_SERVER(inode);
3258 if (S_ISDIR(inode->i_mode))
3260 if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_MODE)) {
3263 ret = __nfs_revalidate_inode(server, inode);
3265 if (ret == 0 && !execute_ok(inode))
3271 struct inode *inode,
3277 nfs_inc_stats(inode, NFSIOS_VFSACCESS);
3285 switch (inode->i_mode & S_IFMT) {
3290 nfs_server_capable(inode, NFS_CAP_ATOMIC_OPEN))
3303 if (!NFS_PROTO(inode)->access)
3306 res = nfs_do_access(inode, cred, mask);
3309 res = nfs_execute_ok(inode, mask);
3312 inode->i_sb->s_id, inode->i_ino, mask, res);
3318 res = nfs_revalidate_inode(inode, NFS_INO_INVALID_MODE |
3321 res = generic_permission(&nop_mnt_idmap, inode, mask);