Lines Matching refs:fhp
154 static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
156 struct knfsd_fh *fh = &fhp->fh_handle;
203 trace_nfsd_set_fh_dentry_badexport(rqstp, fhp, PTR_ERR(exp));
253 trace_nfsd_set_fh_dentry_badhandle(rqstp, fhp,
278 fhp->fh_dentry = dentry;
279 fhp->fh_export = exp;
284 fhp->fh_no_atomic_attr = true;
288 fhp->fh_no_wcc = true;
291 fhp->fh_no_wcc = true;
303 * @fhp: filehandle to be verified
311 * called on @fhp when the caller is finished with the filehandle.
328 fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
334 if (!fhp->fh_dentry) {
335 error = nfsd_set_fh_dentry(rqstp, fhp);
339 dentry = fhp->fh_dentry;
340 exp = fhp->fh_export;
342 trace_nfsd_fh_verify(rqstp, fhp, type, access);
396 trace_nfsd_fh_verify_err(rqstp, fhp, type, access, error);
410 static void _fh_update(struct svc_fh *fhp, struct svc_export *exp,
415 (fhp->fh_handle.fh_fsid + fhp->fh_handle.fh_size/4 - 1);
416 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
422 fhp->fh_handle.fh_fileid_type =
424 fhp->fh_handle.fh_size += maxsize * 4;
426 fhp->fh_handle.fh_fileid_type = FILEID_ROOT;
465 static void set_version_and_fsid_type(struct svc_fh *fhp, struct svc_export *exp, struct svc_fh *ref_fh)
498 if (fhp->fh_maxsize >= 64) {
514 fhp->fh_handle.fh_version = version;
516 fhp->fh_handle.fh_fsid_type = fsid_type;
520 fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
541 set_version_and_fsid_type(fhp, exp, ref_fh);
544 fhp->fh_no_wcc = ref_fh ? ref_fh->fh_no_wcc : false;
546 if (ref_fh == fhp)
549 if (fhp->fh_dentry) {
553 if (fhp->fh_maxsize < NFS_FHSIZE)
555 fhp->fh_maxsize,
558 fhp->fh_dentry = dget(dentry); /* our internal copy */
559 fhp->fh_export = exp_get(exp);
561 fhp->fh_handle.fh_size =
562 key_len(fhp->fh_handle.fh_fsid_type) + 4;
563 fhp->fh_handle.fh_auth_type = 0;
565 mk_fsid(fhp->fh_handle.fh_fsid_type,
566 fhp->fh_handle.fh_fsid,
572 _fh_update(fhp, exp, dentry);
573 if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) {
574 fh_put(fhp);
586 fh_update(struct svc_fh *fhp)
590 if (!fhp->fh_dentry)
593 dentry = fhp->fh_dentry;
596 if (fhp->fh_handle.fh_fileid_type != FILEID_ROOT)
599 _fh_update(fhp, fhp->fh_export, dentry);
600 if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID)
614 * @fhp: file handle to be updated
617 __be32 __must_check fh_fill_pre_attrs(struct svc_fh *fhp)
619 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
624 if (fhp->fh_no_wcc || fhp->fh_pre_saved)
627 inode = d_inode(fhp->fh_dentry);
628 err = fh_getattr(fhp, &stat);
633 fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode);
635 fhp->fh_pre_mtime = stat.mtime;
636 fhp->fh_pre_ctime = stat.ctime;
637 fhp->fh_pre_size = stat.size;
638 fhp->fh_pre_saved = true;
644 * @fhp: file handle to be updated
647 __be32 fh_fill_post_attrs(struct svc_fh *fhp)
649 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
650 struct inode *inode = d_inode(fhp->fh_dentry);
653 if (fhp->fh_no_wcc)
656 if (fhp->fh_post_saved)
659 err = fh_getattr(fhp, &fhp->fh_post_attr);
663 fhp->fh_post_saved = true;
665 fhp->fh_post_change =
666 nfsd4_change_attribute(&fhp->fh_post_attr, inode);
672 * @fhp: file handle to be updated
677 __be32 __must_check fh_fill_both_attrs(struct svc_fh *fhp)
681 err = fh_fill_post_attrs(fhp);
685 fhp->fh_pre_change = fhp->fh_post_change;
686 fhp->fh_pre_mtime = fhp->fh_post_attr.mtime;
687 fhp->fh_pre_ctime = fhp->fh_post_attr.ctime;
688 fhp->fh_pre_size = fhp->fh_post_attr.size;
689 fhp->fh_pre_saved = true;
697 fh_put(struct svc_fh *fhp)
699 struct dentry * dentry = fhp->fh_dentry;
700 struct svc_export * exp = fhp->fh_export;
702 fhp->fh_dentry = NULL;
704 fh_clear_pre_post_attrs(fhp);
706 fh_drop_write(fhp);
709 fhp->fh_export = NULL;
711 fhp->fh_no_wcc = false;
718 char * SVCFH_fmt(struct svc_fh *fhp)
720 struct knfsd_fh *fh = &fhp->fh_handle;
729 enum fsid_source fsid_source(const struct svc_fh *fhp)
731 if (fhp->fh_handle.fh_version != 1)
733 switch(fhp->fh_handle.fh_fsid_type) {
737 if (exp_sb(fhp->fh_export)->s_type->fs_flags & FS_REQUIRES_DEV)
741 if (fhp->fh_export->ex_flags & NFSEXP_FSID)
750 if (fhp->fh_export->ex_flags & NFSEXP_FSID)
752 if (fhp->fh_export->ex_uuid)