nfsfh.h (19d008b46941b8c668402170522e0f7a9258409c) | nfsfh.h (dd8dd403d7b223cc77ee89d8d09caf045e90e648) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 4 * 5 * This file describes the layout of the file handles as passed 6 * over the wire. 7 */ 8#ifndef _LINUX_NFSD_NFSFH_H --- 67 unchanged lines hidden (view full) --- 76 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3. 77 */ 78typedef struct svc_fh { 79 struct knfsd_fh fh_handle; /* FH data */ 80 int fh_maxsize; /* max size for fh_handle */ 81 struct dentry * fh_dentry; /* validated dentry */ 82 struct svc_export * fh_export; /* export pointer */ 83 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 4 * 5 * This file describes the layout of the file handles as passed 6 * over the wire. 7 */ 8#ifndef _LINUX_NFSD_NFSFH_H --- 67 unchanged lines hidden (view full) --- 76 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3. 77 */ 78typedef struct svc_fh { 79 struct knfsd_fh fh_handle; /* FH data */ 80 int fh_maxsize; /* max size for fh_handle */ 81 struct dentry * fh_dentry; /* validated dentry */ 82 struct svc_export * fh_export; /* export pointer */ 83 |
84 bool fh_locked; /* inode locked by us */ | |
85 bool fh_want_write; /* remount protection taken */ 86 bool fh_no_wcc; /* no wcc data needed */ 87 bool fh_no_atomic_attr; 88 /* 89 * wcc data is not atomic with 90 * operation 91 */ 92 int fh_flags; /* FH flags */ 93 bool fh_post_saved; /* post-op attrs saved */ 94 bool fh_pre_saved; /* pre-op attrs saved */ 95 | 84 bool fh_want_write; /* remount protection taken */ 85 bool fh_no_wcc; /* no wcc data needed */ 86 bool fh_no_atomic_attr; 87 /* 88 * wcc data is not atomic with 89 * operation 90 */ 91 int fh_flags; /* FH flags */ 92 bool fh_post_saved; /* post-op attrs saved */ 93 bool fh_pre_saved; /* pre-op attrs saved */ 94 |
96 /* Pre-op attributes saved during fh_lock */ | 95 /* Pre-op attributes saved when inode is locked */ |
97 __u64 fh_pre_size; /* size before operation */ 98 struct timespec64 fh_pre_mtime; /* mtime before oper */ 99 struct timespec64 fh_pre_ctime; /* ctime before oper */ 100 /* 101 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode) 102 * to find out if it is valid. 103 */ 104 u64 fh_pre_change; 105 | 96 __u64 fh_pre_size; /* size before operation */ 97 struct timespec64 fh_pre_mtime; /* mtime before oper */ 98 struct timespec64 fh_pre_ctime; /* ctime before oper */ 99 /* 100 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode) 101 * to find out if it is valid. 102 */ 103 u64 fh_pre_change; 104 |
106 /* Post-op attributes saved in fh_unlock */ | 105 /* Post-op attributes saved in fh_fill_post_attrs() */ |
107 struct kstat fh_post_attr; /* full attrs after operation */ 108 u64 fh_post_change; /* nfsv4 change; see above */ 109} svc_fh; 110#define NFSD4_FH_FOREIGN (1<<0) 111#define SET_FH_FLAG(c, f) ((c)->fh_flags |= (f)) 112#define HAS_FH_FLAG(c, f) ((c)->fh_flags & (f)) 113 114enum nfsd_fsid { --- 103 unchanged lines hidden (view full) --- 218__be32 fh_verify(struct svc_rqst *, struct svc_fh *, umode_t, int); 219__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 220__be32 fh_update(struct svc_fh *); 221void fh_put(struct svc_fh *); 222 223static __inline__ struct svc_fh * 224fh_copy(struct svc_fh *dst, struct svc_fh *src) 225{ | 106 struct kstat fh_post_attr; /* full attrs after operation */ 107 u64 fh_post_change; /* nfsv4 change; see above */ 108} svc_fh; 109#define NFSD4_FH_FOREIGN (1<<0) 110#define SET_FH_FLAG(c, f) ((c)->fh_flags |= (f)) 111#define HAS_FH_FLAG(c, f) ((c)->fh_flags & (f)) 112 113enum nfsd_fsid { --- 103 unchanged lines hidden (view full) --- 217__be32 fh_verify(struct svc_rqst *, struct svc_fh *, umode_t, int); 218__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 219__be32 fh_update(struct svc_fh *); 220void fh_put(struct svc_fh *); 221 222static __inline__ struct svc_fh * 223fh_copy(struct svc_fh *dst, struct svc_fh *src) 224{ |
226 WARN_ON(src->fh_dentry || src->fh_locked); 227 | 225 WARN_ON(src->fh_dentry); 226 |
228 *dst = *src; 229 return dst; 230} 231 232static inline void 233fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) 234{ 235 dst->fh_size = src->fh_size; --- 82 unchanged lines hidden (view full) --- 318 return chattr; 319 } else 320 return time_to_chattr(&stat->ctime); 321} 322 323extern void fh_fill_pre_attrs(struct svc_fh *fhp); 324extern void fh_fill_post_attrs(struct svc_fh *fhp); 325extern void fh_fill_both_attrs(struct svc_fh *fhp); | 227 *dst = *src; 228 return dst; 229} 230 231static inline void 232fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) 233{ 234 dst->fh_size = src->fh_size; --- 82 unchanged lines hidden (view full) --- 317 return chattr; 318 } else 319 return time_to_chattr(&stat->ctime); 320} 321 322extern void fh_fill_pre_attrs(struct svc_fh *fhp); 323extern void fh_fill_post_attrs(struct svc_fh *fhp); 324extern void fh_fill_both_attrs(struct svc_fh *fhp); |
326 327/* 328 * Lock a file handle/inode 329 * NOTE: both fh_lock and fh_unlock are done "by hand" in 330 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once 331 * so, any changes here should be reflected there. 332 */ 333 334static inline void 335fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) 336{ 337 struct dentry *dentry = fhp->fh_dentry; 338 struct inode *inode; 339 340 BUG_ON(!dentry); 341 342 if (fhp->fh_locked) { 343 printk(KERN_WARNING "fh_lock: %pd2 already locked!\n", 344 dentry); 345 return; 346 } 347 348 inode = d_inode(dentry); 349 inode_lock_nested(inode, subclass); 350 fh_fill_pre_attrs(fhp); 351 fhp->fh_locked = true; 352} 353 354static inline void 355fh_lock(struct svc_fh *fhp) 356{ 357 fh_lock_nested(fhp, I_MUTEX_NORMAL); 358} 359 360/* 361 * Unlock a file handle/inode 362 */ 363static inline void 364fh_unlock(struct svc_fh *fhp) 365{ 366 if (fhp->fh_locked) { 367 fh_fill_post_attrs(fhp); 368 inode_unlock(d_inode(fhp->fh_dentry)); 369 fhp->fh_locked = false; 370 } 371} 372 | |
373#endif /* _LINUX_NFSD_NFSFH_H */ | 325#endif /* _LINUX_NFSD_NFSFH_H */ |