dir.c (8ef2ce3e16d9bec6cf015207c1c82a5b864046ac) | dir.c (7c5130588d691a3b34d02312f1bd1b6d56fe0100) |
---|---|
1/* 2 * linux/fs/nfs/dir.c 3 * 4 * Copyright (C) 1992 Rick Sladkey 5 * 6 * nfs directory handling functions 7 * 8 * 10 Apr 1996 Added silly rename for unlink --okir --- 30 unchanged lines hidden (view full) --- 39#include "delegation.h" 40#include "iostat.h" 41#include "internal.h" 42#include "fscache.h" 43 44/* #define NFS_DEBUG_VERBOSE 1 */ 45 46static int nfs_opendir(struct inode *, struct file *); | 1/* 2 * linux/fs/nfs/dir.c 3 * 4 * Copyright (C) 1992 Rick Sladkey 5 * 6 * nfs directory handling functions 7 * 8 * 10 Apr 1996 Added silly rename for unlink --okir --- 30 unchanged lines hidden (view full) --- 39#include "delegation.h" 40#include "iostat.h" 41#include "internal.h" 42#include "fscache.h" 43 44/* #define NFS_DEBUG_VERBOSE 1 */ 45 46static int nfs_opendir(struct inode *, struct file *); |
47static int nfs_closedir(struct inode *, struct file *); | |
48static int nfs_readdir(struct file *, void *, filldir_t); 49static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); 50static int nfs_create(struct inode *, struct dentry *, int, struct nameidata *); 51static int nfs_mkdir(struct inode *, struct dentry *, int); 52static int nfs_rmdir(struct inode *, struct dentry *); 53static int nfs_unlink(struct inode *, struct dentry *); 54static int nfs_symlink(struct inode *, struct dentry *, const char *); 55static int nfs_link(struct dentry *, struct inode *, struct dentry *); --- 4 unchanged lines hidden (view full) --- 60static loff_t nfs_llseek_dir(struct file *, loff_t, int); 61static void nfs_readdir_clear_array(struct page*); 62 63const struct file_operations nfs_dir_operations = { 64 .llseek = nfs_llseek_dir, 65 .read = generic_read_dir, 66 .readdir = nfs_readdir, 67 .open = nfs_opendir, | 47static int nfs_readdir(struct file *, void *, filldir_t); 48static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); 49static int nfs_create(struct inode *, struct dentry *, int, struct nameidata *); 50static int nfs_mkdir(struct inode *, struct dentry *, int); 51static int nfs_rmdir(struct inode *, struct dentry *); 52static int nfs_unlink(struct inode *, struct dentry *); 53static int nfs_symlink(struct inode *, struct dentry *, const char *); 54static int nfs_link(struct dentry *, struct inode *, struct dentry *); --- 4 unchanged lines hidden (view full) --- 59static loff_t nfs_llseek_dir(struct file *, loff_t, int); 60static void nfs_readdir_clear_array(struct page*); 61 62const struct file_operations nfs_dir_operations = { 63 .llseek = nfs_llseek_dir, 64 .read = generic_read_dir, 65 .readdir = nfs_readdir, 66 .open = nfs_opendir, |
68 .release = nfs_closedir, | 67 .release = nfs_release, |
69 .fsync = nfs_fsync_dir, 70}; 71 72const struct inode_operations nfs_dir_inode_operations = { 73 .create = nfs_create, 74 .lookup = nfs_lookup, 75 .link = nfs_link, 76 .unlink = nfs_unlink, --- 52 unchanged lines hidden (view full) --- 129 .getxattr = generic_getxattr, 130 .setxattr = generic_setxattr, 131 .listxattr = generic_listxattr, 132 .removexattr = generic_removexattr, 133}; 134 135#endif /* CONFIG_NFS_V4 */ 136 | 68 .fsync = nfs_fsync_dir, 69}; 70 71const struct inode_operations nfs_dir_inode_operations = { 72 .create = nfs_create, 73 .lookup = nfs_lookup, 74 .link = nfs_link, 75 .unlink = nfs_unlink, --- 52 unchanged lines hidden (view full) --- 128 .getxattr = generic_getxattr, 129 .setxattr = generic_setxattr, 130 .listxattr = generic_listxattr, 131 .removexattr = generic_removexattr, 132}; 133 134#endif /* CONFIG_NFS_V4 */ 135 |
137static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct rpc_cred *cred) 138{ 139 struct nfs_open_dir_context *ctx; 140 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); 141 if (ctx != NULL) { 142 ctx->duped = 0; 143 ctx->dir_cookie = 0; 144 ctx->dup_cookie = 0; 145 ctx->cred = get_rpccred(cred); 146 } else 147 ctx = ERR_PTR(-ENOMEM); 148 return ctx; 149} 150 151static void put_nfs_open_dir_context(struct nfs_open_dir_context *ctx) 152{ 153 put_rpccred(ctx->cred); 154 kfree(ctx); 155} 156 | |
157/* 158 * Open file 159 */ 160static int 161nfs_opendir(struct inode *inode, struct file *filp) 162{ | 136/* 137 * Open file 138 */ 139static int 140nfs_opendir(struct inode *inode, struct file *filp) 141{ |
163 int res = 0; 164 struct nfs_open_dir_context *ctx; 165 struct rpc_cred *cred; | 142 int res; |
166 167 dfprintk(FILE, "NFS: open dir(%s/%s)\n", 168 filp->f_path.dentry->d_parent->d_name.name, 169 filp->f_path.dentry->d_name.name); 170 171 nfs_inc_stats(inode, NFSIOS_VFSOPEN); 172 | 143 144 dfprintk(FILE, "NFS: open dir(%s/%s)\n", 145 filp->f_path.dentry->d_parent->d_name.name, 146 filp->f_path.dentry->d_name.name); 147 148 nfs_inc_stats(inode, NFSIOS_VFSOPEN); 149 |
173 cred = rpc_lookup_cred(); 174 if (IS_ERR(cred)) 175 return PTR_ERR(cred); 176 ctx = alloc_nfs_open_dir_context(cred); 177 if (IS_ERR(ctx)) { 178 res = PTR_ERR(ctx); 179 goto out; 180 } 181 filp->private_data = ctx; | 150 /* Call generic open code in order to cache credentials */ 151 res = nfs_open(inode, filp); |
182 if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { 183 /* This is a mountpoint, so d_revalidate will never 184 * have been called, so we need to refresh the 185 * inode (for close-open consistency) ourselves. 186 */ 187 __nfs_revalidate_inode(NFS_SERVER(inode), inode); 188 } | 152 if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { 153 /* This is a mountpoint, so d_revalidate will never 154 * have been called, so we need to refresh the 155 * inode (for close-open consistency) ourselves. 156 */ 157 __nfs_revalidate_inode(NFS_SERVER(inode), inode); 158 } |
189out: 190 put_rpccred(cred); | |
191 return res; 192} 193 | 159 return res; 160} 161 |
194static int 195nfs_closedir(struct inode *inode, struct file *filp) 196{ 197 put_nfs_open_dir_context(filp->private_data); 198 return 0; 199} 200 | |
201struct nfs_cache_array_entry { 202 u64 cookie; 203 u64 ino; 204 struct qstr string; 205 unsigned char d_type; 206}; 207 208struct nfs_cache_array { --- 109 unchanged lines hidden (view full) --- 318 return ret; 319} 320 321static 322int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) 323{ 324 loff_t diff = desc->file->f_pos - desc->current_index; 325 unsigned int index; | 162struct nfs_cache_array_entry { 163 u64 cookie; 164 u64 ino; 165 struct qstr string; 166 unsigned char d_type; 167}; 168 169struct nfs_cache_array { --- 109 unchanged lines hidden (view full) --- 279 return ret; 280} 281 282static 283int nfs_readdir_search_for_pos(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) 284{ 285 loff_t diff = desc->file->f_pos - desc->current_index; 286 unsigned int index; |
326 struct nfs_open_dir_context *ctx = desc->file->private_data; | |
327 328 if (diff < 0) 329 goto out_eof; 330 if (diff >= array->size) { 331 if (array->eof_index >= 0) 332 goto out_eof; | 287 288 if (diff < 0) 289 goto out_eof; 290 if (diff >= array->size) { 291 if (array->eof_index >= 0) 292 goto out_eof; |
293 desc->current_index += array->size; |
|
333 return -EAGAIN; 334 } 335 336 index = (unsigned int)diff; 337 *desc->dir_cookie = array->array[index].cookie; 338 desc->cache_entry_index = index; | 294 return -EAGAIN; 295 } 296 297 index = (unsigned int)diff; 298 *desc->dir_cookie = array->array[index].cookie; 299 desc->cache_entry_index = index; |
339 ctx->duped = 0; | |
340 return 0; 341out_eof: 342 desc->eof = 1; 343 return -EBADCOOKIE; 344} 345 346static 347int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) 348{ 349 int i; | 300 return 0; 301out_eof: 302 desc->eof = 1; 303 return -EBADCOOKIE; 304} 305 306static 307int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) 308{ 309 int i; |
350 loff_t new_pos; | |
351 int status = -EAGAIN; | 310 int status = -EAGAIN; |
352 struct nfs_open_dir_context *ctx = desc->file->private_data; | |
353 354 for (i = 0; i < array->size; i++) { 355 if (array->array[i].cookie == *desc->dir_cookie) { | 311 312 for (i = 0; i < array->size; i++) { 313 if (array->array[i].cookie == *desc->dir_cookie) { |
356 new_pos = desc->current_index + i; 357 if (new_pos < desc->file->f_pos) { 358 ctx->dup_cookie = *desc->dir_cookie; 359 ctx->duped = 1; 360 } 361 desc->file->f_pos = new_pos; | |
362 desc->cache_entry_index = i; 363 return 0; 364 } 365 } 366 if (array->eof_index >= 0) { 367 status = -EBADCOOKIE; 368 if (*desc->dir_cookie == array->last_cookie) 369 desc->eof = 1; --- 15 unchanged lines hidden (view full) --- 385 386 if (*desc->dir_cookie == 0) 387 status = nfs_readdir_search_for_pos(array, desc); 388 else 389 status = nfs_readdir_search_for_cookie(array, desc); 390 391 if (status == -EAGAIN) { 392 desc->last_cookie = array->last_cookie; | 314 desc->cache_entry_index = i; 315 return 0; 316 } 317 } 318 if (array->eof_index >= 0) { 319 status = -EBADCOOKIE; 320 if (*desc->dir_cookie == array->last_cookie) 321 desc->eof = 1; --- 15 unchanged lines hidden (view full) --- 337 338 if (*desc->dir_cookie == 0) 339 status = nfs_readdir_search_for_pos(array, desc); 340 else 341 status = nfs_readdir_search_for_cookie(array, desc); 342 343 if (status == -EAGAIN) { 344 desc->last_cookie = array->last_cookie; |
393 desc->current_index += array->size; | |
394 desc->page_index++; 395 } 396 nfs_readdir_release_array(desc->page); 397out: 398 return status; 399} 400 401/* Fill a page with xdr information before transferring to the cache page */ 402static 403int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc, 404 struct nfs_entry *entry, struct file *file, struct inode *inode) 405{ | 345 desc->page_index++; 346 } 347 nfs_readdir_release_array(desc->page); 348out: 349 return status; 350} 351 352/* Fill a page with xdr information before transferring to the cache page */ 353static 354int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc, 355 struct nfs_entry *entry, struct file *file, struct inode *inode) 356{ |
406 struct nfs_open_dir_context *ctx = file->private_data; 407 struct rpc_cred *cred = ctx->cred; | 357 struct rpc_cred *cred = nfs_file_cred(file); |
408 unsigned long timestamp, gencount; 409 int error; 410 411 again: 412 timestamp = jiffies; 413 gencount = nfs_inc_attr_generation_counter(); 414 error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, entry->cookie, pages, 415 NFS_SERVER(inode)->dtsize, desc->plus); --- 322 unchanged lines hidden (view full) --- 738static 739int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, 740 filldir_t filldir) 741{ 742 struct file *file = desc->file; 743 int i = 0; 744 int res = 0; 745 struct nfs_cache_array *array = NULL; | 358 unsigned long timestamp, gencount; 359 int error; 360 361 again: 362 timestamp = jiffies; 363 gencount = nfs_inc_attr_generation_counter(); 364 error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, entry->cookie, pages, 365 NFS_SERVER(inode)->dtsize, desc->plus); --- 322 unchanged lines hidden (view full) --- 688static 689int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, 690 filldir_t filldir) 691{ 692 struct file *file = desc->file; 693 int i = 0; 694 int res = 0; 695 struct nfs_cache_array *array = NULL; |
746 struct nfs_open_dir_context *ctx = file->private_data; | |
747 | 696 |
748 if (ctx->duped != 0 && ctx->dup_cookie == *desc->dir_cookie) { 749 if (printk_ratelimit()) { 750 pr_notice("NFS: directory %s/%s contains a readdir loop. " 751 "Please contact your server vendor. " 752 "Offending cookie: %llu\n", 753 file->f_dentry->d_parent->d_name.name, 754 file->f_dentry->d_name.name, 755 *desc->dir_cookie); 756 } 757 res = -ELOOP; 758 goto out; 759 } 760 | |
761 array = nfs_readdir_get_array(desc->page); 762 if (IS_ERR(array)) { 763 res = PTR_ERR(array); 764 goto out; 765 } 766 767 for (i = desc->cache_entry_index; i < array->size; i++) { 768 struct nfs_cache_array_entry *ent; --- 75 unchanged lines hidden (view full) --- 844 whole directory. 845 */ 846static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 847{ 848 struct dentry *dentry = filp->f_path.dentry; 849 struct inode *inode = dentry->d_inode; 850 nfs_readdir_descriptor_t my_desc, 851 *desc = &my_desc; | 697 array = nfs_readdir_get_array(desc->page); 698 if (IS_ERR(array)) { 699 res = PTR_ERR(array); 700 goto out; 701 } 702 703 for (i = desc->cache_entry_index; i < array->size; i++) { 704 struct nfs_cache_array_entry *ent; --- 75 unchanged lines hidden (view full) --- 780 whole directory. 781 */ 782static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 783{ 784 struct dentry *dentry = filp->f_path.dentry; 785 struct inode *inode = dentry->d_inode; 786 nfs_readdir_descriptor_t my_desc, 787 *desc = &my_desc; |
852 struct nfs_open_dir_context *dir_ctx = filp->private_data; | |
853 int res; 854 855 dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", 856 dentry->d_parent->d_name.name, dentry->d_name.name, 857 (long long)filp->f_pos); 858 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS); 859 860 /* 861 * filp->f_pos points to the dirent entry number. 862 * *desc->dir_cookie has the cookie for the next entry. We have 863 * to either find the entry with the appropriate number or 864 * revalidate the cookie. 865 */ 866 memset(desc, 0, sizeof(*desc)); 867 868 desc->file = filp; | 788 int res; 789 790 dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", 791 dentry->d_parent->d_name.name, dentry->d_name.name, 792 (long long)filp->f_pos); 793 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS); 794 795 /* 796 * filp->f_pos points to the dirent entry number. 797 * *desc->dir_cookie has the cookie for the next entry. We have 798 * to either find the entry with the appropriate number or 799 * revalidate the cookie. 800 */ 801 memset(desc, 0, sizeof(*desc)); 802 803 desc->file = filp; |
869 desc->dir_cookie = &dir_ctx->dir_cookie; | 804 desc->dir_cookie = &nfs_file_open_context(filp)->dir_cookie; |
870 desc->decode = NFS_PROTO(inode)->decode_dirent; 871 desc->plus = NFS_USE_READDIRPLUS(inode); 872 873 nfs_block_sillyrename(dentry); 874 res = nfs_revalidate_mapping(inode, filp->f_mapping); 875 if (res < 0) 876 goto out; 877 --- 35 unchanged lines hidden (view full) --- 913 res); 914 return res; 915} 916 917static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) 918{ 919 struct dentry *dentry = filp->f_path.dentry; 920 struct inode *inode = dentry->d_inode; | 805 desc->decode = NFS_PROTO(inode)->decode_dirent; 806 desc->plus = NFS_USE_READDIRPLUS(inode); 807 808 nfs_block_sillyrename(dentry); 809 res = nfs_revalidate_mapping(inode, filp->f_mapping); 810 if (res < 0) 811 goto out; 812 --- 35 unchanged lines hidden (view full) --- 848 res); 849 return res; 850} 851 852static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) 853{ 854 struct dentry *dentry = filp->f_path.dentry; 855 struct inode *inode = dentry->d_inode; |
921 struct nfs_open_dir_context *dir_ctx = filp->private_data; | |
922 923 dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n", 924 dentry->d_parent->d_name.name, 925 dentry->d_name.name, 926 offset, origin); 927 928 mutex_lock(&inode->i_mutex); 929 switch (origin) { 930 case 1: 931 offset += filp->f_pos; 932 case 0: 933 if (offset >= 0) 934 break; 935 default: 936 offset = -EINVAL; 937 goto out; 938 } 939 if (offset != filp->f_pos) { 940 filp->f_pos = offset; | 856 857 dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n", 858 dentry->d_parent->d_name.name, 859 dentry->d_name.name, 860 offset, origin); 861 862 mutex_lock(&inode->i_mutex); 863 switch (origin) { 864 case 1: 865 offset += filp->f_pos; 866 case 0: 867 if (offset >= 0) 868 break; 869 default: 870 offset = -EINVAL; 871 goto out; 872 } 873 if (offset != filp->f_pos) { 874 filp->f_pos = offset; |
941 dir_ctx->dir_cookie = 0; 942 dir_ctx->duped = 0; | 875 nfs_file_open_context(filp)->dir_cookie = 0; |
943 } 944out: 945 mutex_unlock(&inode->i_mutex); 946 return offset; 947} 948 949/* 950 * All directory operations under NFS are synchronous, so fsync() --- 179 unchanged lines hidden (view full) --- 1130 goto out_bad; 1131 1132 error = -ENOMEM; 1133 fhandle = nfs_alloc_fhandle(); 1134 fattr = nfs_alloc_fattr(); 1135 if (fhandle == NULL || fattr == NULL) 1136 goto out_error; 1137 | 876 } 877out: 878 mutex_unlock(&inode->i_mutex); 879 return offset; 880} 881 882/* 883 * All directory operations under NFS are synchronous, so fsync() --- 179 unchanged lines hidden (view full) --- 1063 goto out_bad; 1064 1065 error = -ENOMEM; 1066 fhandle = nfs_alloc_fhandle(); 1067 fattr = nfs_alloc_fattr(); 1068 if (fhandle == NULL || fattr == NULL) 1069 goto out_error; 1070 |
1138 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); | 1071 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr); |
1139 if (error) 1140 goto out_bad; 1141 if (nfs_compare_fh(NFS_FH(inode), fhandle)) 1142 goto out_bad; 1143 if ((error = nfs_refresh_inode(inode, fattr)) != 0) 1144 goto out_bad; 1145 1146 nfs_free_fattr(fattr); --- 84 unchanged lines hidden (view full) --- 1231 1232 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { 1233 drop_nlink(inode); 1234 nfs_complete_unlink(dentry, inode); 1235 } 1236 iput(inode); 1237} 1238 | 1072 if (error) 1073 goto out_bad; 1074 if (nfs_compare_fh(NFS_FH(inode), fhandle)) 1075 goto out_bad; 1076 if ((error = nfs_refresh_inode(inode, fattr)) != 0) 1077 goto out_bad; 1078 1079 nfs_free_fattr(fattr); --- 84 unchanged lines hidden (view full) --- 1164 1165 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { 1166 drop_nlink(inode); 1167 nfs_complete_unlink(dentry, inode); 1168 } 1169 iput(inode); 1170} 1171 |
1172static void nfs_d_release(struct dentry *dentry) 1173{ 1174 /* free cached devname value, if it survived that far */ 1175 if (unlikely(dentry->d_fsdata)) { 1176 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) 1177 WARN_ON(1); 1178 else 1179 kfree(dentry->d_fsdata); 1180 } 1181} 1182 |
|
1239const struct dentry_operations nfs_dentry_operations = { 1240 .d_revalidate = nfs_lookup_revalidate, 1241 .d_delete = nfs_dentry_delete, 1242 .d_iput = nfs_dentry_iput, 1243 .d_automount = nfs_d_automount, | 1183const struct dentry_operations nfs_dentry_operations = { 1184 .d_revalidate = nfs_lookup_revalidate, 1185 .d_delete = nfs_dentry_delete, 1186 .d_iput = nfs_dentry_iput, 1187 .d_automount = nfs_d_automount, |
1188 .d_release = nfs_d_release, |
|
1244}; 1245 1246static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 1247{ 1248 struct dentry *res; 1249 struct dentry *parent; 1250 struct inode *inode = NULL; 1251 struct nfs_fh *fhandle = NULL; --- 22 unchanged lines hidden (view full) --- 1274 fhandle = nfs_alloc_fhandle(); 1275 fattr = nfs_alloc_fattr(); 1276 if (fhandle == NULL || fattr == NULL) 1277 goto out; 1278 1279 parent = dentry->d_parent; 1280 /* Protect against concurrent sillydeletes */ 1281 nfs_block_sillyrename(parent); | 1189}; 1190 1191static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 1192{ 1193 struct dentry *res; 1194 struct dentry *parent; 1195 struct inode *inode = NULL; 1196 struct nfs_fh *fhandle = NULL; --- 22 unchanged lines hidden (view full) --- 1219 fhandle = nfs_alloc_fhandle(); 1220 fattr = nfs_alloc_fattr(); 1221 if (fhandle == NULL || fattr == NULL) 1222 goto out; 1223 1224 parent = dentry->d_parent; 1225 /* Protect against concurrent sillydeletes */ 1226 nfs_block_sillyrename(parent); |
1282 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); | 1227 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr); |
1283 if (error == -ENOENT) 1284 goto no_entry; 1285 if (error < 0) { 1286 res = ERR_PTR(error); 1287 goto out_unblock_sillyrename; 1288 } 1289 inode = nfs_fhget(dentry->d_sb, fhandle, fattr); 1290 res = ERR_CAST(inode); --- 19 unchanged lines hidden (view full) --- 1310#ifdef CONFIG_NFS_V4 1311static int nfs_open_revalidate(struct dentry *, struct nameidata *); 1312 1313const struct dentry_operations nfs4_dentry_operations = { 1314 .d_revalidate = nfs_open_revalidate, 1315 .d_delete = nfs_dentry_delete, 1316 .d_iput = nfs_dentry_iput, 1317 .d_automount = nfs_d_automount, | 1228 if (error == -ENOENT) 1229 goto no_entry; 1230 if (error < 0) { 1231 res = ERR_PTR(error); 1232 goto out_unblock_sillyrename; 1233 } 1234 inode = nfs_fhget(dentry->d_sb, fhandle, fattr); 1235 res = ERR_CAST(inode); --- 19 unchanged lines hidden (view full) --- 1255#ifdef CONFIG_NFS_V4 1256static int nfs_open_revalidate(struct dentry *, struct nameidata *); 1257 1258const struct dentry_operations nfs4_dentry_operations = { 1259 .d_revalidate = nfs_open_revalidate, 1260 .d_delete = nfs_dentry_delete, 1261 .d_iput = nfs_dentry_iput, 1262 .d_automount = nfs_d_automount, |
1263 .d_release = nfs_d_release, |
|
1318}; 1319 1320/* 1321 * Use intent information to determine whether we need to substitute 1322 * the NFSv4-style stateful OPEN for the LOOKUP call 1323 */ 1324static int is_atomic_open(struct nameidata *nd) 1325{ --- 285 unchanged lines hidden (view full) --- 1611 int error = -EACCES; 1612 1613 d_drop(dentry); 1614 1615 /* We may have been initialized further down */ 1616 if (dentry->d_inode) 1617 goto out; 1618 if (fhandle->size == 0) { | 1264}; 1265 1266/* 1267 * Use intent information to determine whether we need to substitute 1268 * the NFSv4-style stateful OPEN for the LOOKUP call 1269 */ 1270static int is_atomic_open(struct nameidata *nd) 1271{ --- 285 unchanged lines hidden (view full) --- 1557 int error = -EACCES; 1558 1559 d_drop(dentry); 1560 1561 /* We may have been initialized further down */ 1562 if (dentry->d_inode) 1563 goto out; 1564 if (fhandle->size == 0) { |
1619 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr); | 1565 error = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, &dentry->d_name, fhandle, fattr); |
1620 if (error) 1621 goto out_error; 1622 } 1623 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1624 if (!(fattr->valid & NFS_ATTR_FATTR)) { 1625 struct nfs_server *server = NFS_SB(dentry->d_sb); 1626 error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr); 1627 if (error < 0) --- 702 unchanged lines hidden --- | 1566 if (error) 1567 goto out_error; 1568 } 1569 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1570 if (!(fattr->valid & NFS_ATTR_FATTR)) { 1571 struct nfs_server *server = NFS_SB(dentry->d_sb); 1572 error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr); 1573 if (error < 0) --- 702 unchanged lines hidden --- |