aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs
Commit message (Expand)AuthorAge
* Use task_pid_nr() instead of pid_nr(task_pid())Pavel Emelyanov2007-10-19
* pid namespaces: round up the APIPavel Emelianov2007-10-19
* sparse pointer use of zero as nullStephen Hemminger2007-10-18
* Replace pid_t in autofs with struct pid referenceSukadev Bhattiprolu2007-05-11
* Fix some coding-style errors in autofsSukadev Bhattiprolu2007-05-11
* [PATCH] Mark struct super_operations constJosef 'Jeff' Sipek2007-02-12
* [PATCH] mark struct inode_operations const 1Arjan van de Ven2007-02-12
* [PATCH] autofs: change uses of f_{dentry, vfsmnt} to use f_pathJosef "Jeff" Sipek2006-12-08
* [PATCH] autofs: fix error code path in autofs_fill_sb()Jiri Kosina2006-12-07
* [PATCH] autofs4: panic after mount failIan Kent2006-11-14
* [PATCH] autofs3: Make sure all dentries refs are released before calling kill...David Howells2006-10-20
* [PATCH] r/o bind mount prepwork: inc_nlink() helperDave Hansen2006-10-01
* [PATCH] r/o bind mounts: unlink: monitor i_nlinkDave Hansen2006-10-01
* [PATCH] inode-diet: Eliminate i_blksize from the inode structureTheodore Ts'o2006-09-27
* [PATCH] inode_diet: Replace inode.u.generic_ip with inode.i_privateTheodore Ts'o2006-09-27
* [PATCH] fs: Conversions from kmalloc+memset to k(z|c)allocPanagiotis Issaris2006-09-27
* Move several *_SUPER_MAGIC symbols to include/linux/magic.h.Jeff Garzik2006-09-24
* [PATCH] VFS: Permit filesystem to override root dentry on mountDavid Howells2006-06-23
* [PATCH] Make most file operations structs in fs/ constArjan van de Ven2006-03-28
* [PATCH] autofs4: change may_umount* functions to booleanIan Kent2006-03-27
* [PATCH] capable/capability.h (fs/)Randy Dunlap2006-01-11
* [PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_semJes Sorensen2006-01-09
* [PATCH] kfree cleanup: fsJesper Juhl2005-11-07
* [PATCH] autofs: fix "busy inodes after umount..."Alexander Krizhanovsky2005-09-09
* Fix nasty ncpfs symlink handling bug.Linus Torvalds2005-08-19
* Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds2005-04-16
n class="hl com"> * * So, we do our best. If you're lucky, your inode will be in the * client's cache. If it's not, and you have a connectable fh, then * the MDS server may be able to find it for you. Otherwise, you get * ESTALE. * * There are ways to this more reliable, but in the non-connectable fh * case, we won't every work perfectly, and in the connectable case, * some changes are needed on the MDS side to work better. */ /* * Basic fh */ struct ceph_nfs_fh { u64 ino; } __attribute__ ((packed)); /* * Larger 'connectable' fh that includes parent ino and name hash. * Use this whenever possible, as it works more reliably. */ struct ceph_nfs_confh { u64 ino, parent_ino; u32 parent_name_hash; } __attribute__ ((packed)); static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, int connectable) { int type; struct ceph_nfs_fh *fh = (void *)rawfh; struct ceph_nfs_confh *cfh = (void *)rawfh; struct dentry *parent = dentry->d_parent; struct inode *inode = dentry->d_inode; int connected_handle_length = sizeof(*cfh)/4; int handle_length = sizeof(*fh)/4; /* don't re-export snaps */ if (ceph_snap(inode) != CEPH_NOSNAP) return -EINVAL; if (*max_len >= connected_handle_length) { dout("encode_fh %p connectable\n", dentry); cfh->ino = ceph_ino(dentry->d_inode); cfh->parent_ino = ceph_ino(parent->d_inode); cfh->parent_name_hash = ceph_dentry_hash(parent); *max_len = connected_handle_length; type = 2; } else if (*max_len >= handle_length) { if (connectable) { *max_len = connected_handle_length; return 255; } dout("encode_fh %p\n", dentry); fh->ino = ceph_ino(dentry->d_inode); *max_len = handle_length; type = 1; } else { *max_len = handle_length; return 255; } return type; } /* * convert regular fh to dentry * * FIXME: we should try harder by querying the mds for the ino. */ static struct dentry *__fh_to_dentry(struct super_block *sb, struct ceph_nfs_fh *fh) { struct inode *inode; struct dentry *dentry; struct ceph_vino vino; int err; dout("__fh_to_dentry %llx\n", fh->ino); vino.ino = fh->ino; vino.snap = CEPH_NOSNAP; inode = ceph_find_inode(sb, vino); if (!inode) return ERR_PTR(-ESTALE); dentry = d_obtain_alias(inode); if (IS_ERR(dentry)) { pr_err("fh_to_dentry %llx -- inode %p but ENOMEM\n", fh->ino, inode); iput(inode); return dentry; } err = ceph_init_dentry(dentry); if (err < 0) { iput(inode); return ERR_PTR(err); } dout("__fh_to_dentry %llx %p dentry %p\n", fh->ino, inode, dentry); return dentry; } /* * convert connectable fh to dentry */ static struct dentry *__cfh_to_dentry(struct super_block *sb, struct ceph_nfs_confh *cfh) { struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; struct inode *inode; struct dentry *dentry; struct ceph_vino vino; int err; dout("__cfh_to_dentry %llx (%llx/%x)\n", cfh->ino, cfh->parent_ino, cfh->parent_name_hash); vino.ino = cfh->ino; vino.snap = CEPH_NOSNAP; inode = ceph_find_inode(sb, vino); if (!inode) { struct ceph_mds_request *req; req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPHASH, USE_ANY_MDS); if (IS_ERR(req)) return ERR_CAST(req); req->r_ino1 = vino; req->r_ino2.ino = cfh->parent_ino; req->r_ino2.snap = CEPH_NOSNAP; req->r_path2 = kmalloc(16, GFP_NOFS); snprintf(req->r_path2, 16, "%d", cfh->parent_name_hash); req->r_num_caps = 1; err = ceph_mdsc_do_request(mdsc, NULL, req); ceph_mdsc_put_request(req); inode = ceph_find_inode(sb, vino); if (!inode) return ERR_PTR(err ? err : -ESTALE); } dentry = d_obtain_alias(inode); if (IS_ERR(dentry)) { pr_err("cfh_to_dentry %llx -- inode %p but ENOMEM\n", cfh->ino, inode); iput(inode); return dentry; } err = ceph_init_dentry(dentry); if (err < 0) { iput(inode); return ERR_PTR(err); } dout("__cfh_to_dentry %llx %p dentry %p\n", cfh->ino, inode, dentry); return dentry; } static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { if (fh_type == 1) return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw); else return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw); } /* * get parent, if possible. * * FIXME: we could do better by querying the mds to discover the * parent. */ static struct dentry *ceph_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { struct ceph_nfs_confh *cfh = (void *)fid->raw; struct ceph_vino vino; struct inode *inode; struct dentry *dentry; int err; if (fh_type == 1) return ERR_PTR(-ESTALE); pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino, cfh->parent_name_hash); vino.ino = cfh->ino; vino.snap = CEPH_NOSNAP; inode = ceph_find_inode(sb, vino); if (!inode) return ERR_PTR(-ESTALE); dentry = d_obtain_alias(inode); if (IS_ERR(dentry)) { pr_err("fh_to_parent %llx -- inode %p but ENOMEM\n", cfh->ino, inode); iput(inode); return dentry; } err = ceph_init_dentry(dentry); if (err < 0) { iput(inode); return ERR_PTR(err); } dout("fh_to_parent %llx %p dentry %p\n", cfh->ino, inode, dentry); return dentry; } const struct export_operations ceph_export_ops = { .encode_fh = ceph_encode_fh, .fh_to_dentry = ceph_fh_to_dentry, .fh_to_parent = ceph_fh_to_parent, };