17 #define NFSDDBG_FACILITY NFSDDBG_FH
26 static int nfsd_acceptable(
void *expv,
struct dentry *
dentry)
30 struct dentry *tdentry;
36 tdentry = dget(dentry);
49 if (tdentry != exp->
ex_path.dentry)
50 dprintk(
"nfsd_acceptable failed at %p %s\n", tdentry, tdentry->
d_name.name);
51 rv = (tdentry == exp->
ex_path.dentry);
68 if (mode == requested)
92 "nfsd: request from insecure port %s!\n",
112 if (!nfsd_v4client(rqstp))
141 struct dentry *dentry;
152 if (fh->fh_version == 1) {
157 if (fh->fh_auth_type != 0)
159 len =
key_len(fh->fh_fsid_type) / 4;
166 fh->fh_fsid[0] = new_encode_dev(
MKDEV(
ntohl(fh->fh_fsid[0]),
ntohl(fh->fh_fsid[1])));
167 fh->fh_fsid[1] = fh->fh_fsid[2];
173 fid = (
struct fid *)(fh->fh_auth + len);
182 xdev = old_decode_dev(fh->ofh_xdev);
183 xino = u32_to_ino_t(fh->ofh_xino);
189 if (PTR_ERR(exp) == -
ENOENT)
209 cap_raise_nfsd_set(new->cap_effective,
214 error = nfsd_setuser_and_check_port(rqstp, exp);
226 if (fh->fh_version != 1) {
227 sfid.i32.ino = fh->ofh_ino;
228 sfid.i32.gen = fh->ofh_generation;
229 sfid.i32.parent_ino = fh->ofh_dirino;
232 if (fh->ofh_dirino == 0)
237 fileid_type = fh->fh_fileid_type;
240 dentry = dget(exp->
ex_path.dentry);
243 data_left, fileid_type,
244 nfsd_acceptable, exp);
248 if (IS_ERR(dentry)) {
249 if (PTR_ERR(dentry) != -
EINVAL)
256 printk(
"nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n",
299 struct dentry *dentry;
305 error = nfsd_set_fh_dentry(rqstp, fhp);
327 error = check_pseudo_root(rqstp, dentry, exp);
331 error = nfsd_setuser_and_check_port(rqstp, exp);
335 error = nfsd_mode_check(rqstp, dentry->
d_inode->i_mode, type);
345 goto skip_pseudoflavor_check;
352 && exp->
ex_path.dentry == dentry)
353 goto skip_pseudoflavor_check;
359 skip_pseudoflavor_check:
364 dprintk(
"fh_verify: %s/%s permission failure, "
365 "acc=%x, error=%d\n",
368 access,
ntohl(error));
385 struct dentry *dentry)
387 if (dentry != exp->
ex_path.dentry) {
388 struct fid *fid = (
struct fid *)
404 static inline void _fh_update_old(
struct dentry *dentry,
408 fh->ofh_ino = ino_t_to_u32(dentry->
d_inode->i_ino);
409 fh->ofh_generation = dentry->
d_inode->i_generation;
415 static bool is_root_export(
struct svc_export *exp)
422 return exp->
ex_path.dentry->d_inode->i_sb;
425 static bool fsid_type_ok_for_exp(
u8 fsid_type,
struct svc_export *exp)
429 if (!old_valid_dev(exp_sb(exp)->
s_dev))
439 if (!is_root_export(exp))
456 if (ref_fh && ref_fh->
fh_export == exp) {
458 fsid_type = ref_fh->
fh_handle.fh_fsid_type;
478 if (!fsid_type_ok_for_exp(fsid_type, exp))
484 if (is_root_export(exp))
489 if (is_root_export(exp))
494 }
else if (!old_valid_dev(exp_sb(exp)->
s_dev))
519 dev_t ex_dev = exp_sb(exp)->s_dev;
521 dprintk(
"nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
523 (
long) exp->
ex_path.dentry->d_inode->i_ino,
525 (inode ? inode->
i_ino : 0));
531 set_version_and_fsid_type(fhp, exp, ref_fh);
554 fhp->
fh_handle.ofh_dev = old_encode_dev(ex_dev);
557 ino_t_to_u32(exp->
ex_path.dentry->d_inode->i_ino);
560 _fh_update_old(dentry, exp, &fhp->
fh_handle);
565 mk_fsid(fhp->
fh_handle.fh_fsid_type, datap, ex_dev,
566 exp->
ex_path.dentry->d_inode->i_ino,
574 _fh_update(fhp, exp, dentry);
575 if (fhp->
fh_handle.fh_fileid_type == 255) {
591 struct dentry *dentry;
606 if (fhp->
fh_handle.fh_fileid_type == 255)
633 #ifdef CONFIG_NFSD_V3
634 fhp->fh_pre_saved = 0;
635 fhp->fh_post_saved = 0;
654 sprintf(buf,
"%d: %08x %08x %08x %08x %08x %08x",