···801801802802/* llite/dcache.c */803803804804-int ll_d_init(struct dentry *de);805804extern const struct dentry_operations ll_d_ops;806805void ll_intent_drop_lock(struct lookup_intent *);807806void ll_intent_release(struct lookup_intent *);···11881189 * 'lld_sa_generation == lli->lli_sa_generation'.11891190 */11901191 ldd = ll_d2d(dentry);11911191- if (ldd && ldd->lld_sa_generation == lli->lli_sa_generation)11921192+ if (ldd->lld_sa_generation == lli->lli_sa_generation)11921193 return false;1193119411941195 return true;···1316131713171318static inline int d_lustre_invalid(const struct dentry *dentry)13181319{13191319- struct ll_dentry_data *lld = ll_d2d(dentry);13201320-13211321- return !lld || lld->lld_invalid;13221322-}13231323-13241324-static inline void __d_lustre_invalidate(struct dentry *dentry)13251325-{13261326- struct ll_dentry_data *lld = ll_d2d(dentry);13271327-13281328- if (lld)13291329- lld->lld_invalid = 1;13201320+ return ll_d2d(dentry)->lld_invalid;13301321}1331132213321323/*···1332134313331344 spin_lock_nested(&dentry->d_lock,13341345 nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);13351335- __d_lustre_invalidate(dentry);13461346+ ll_d2d(dentry)->lld_invalid = 1;13361347 /*13371348 * We should be careful about dentries created by d_obtain_alias().13381349 * These dentries are not put in the dentry tree, instead they are
+6-16
drivers/staging/lustre/lustre/llite/llite_nfs.c
···169169 /* N.B. d_obtain_alias() drops inode ref on error */170170 result = d_obtain_alias(inode);171171 if (!IS_ERR(result)) {172172- int rc;173173-174174- rc = ll_d_init(result);175175- if (rc < 0) {176176- dput(result);177177- result = ERR_PTR(rc);178178- } else {179179- struct ll_dentry_data *ldd = ll_d2d(result);180180-181181- /*182182- * Need to signal to the ll_intent_file_open that183183- * we came from NFS and so opencache needs to be184184- * enabled for this one185185- */186186- ldd->lld_nfs_dentry = 1;187187- }172172+ /*173173+ * Need to signal to the ll_intent_file_open that174174+ * we came from NFS and so opencache needs to be175175+ * enabled for this one176176+ */177177+ ll_d2d(result)->lld_nfs_dentry = 1;188178 }189179190180 return result;
···934934extern const struct file_operations ceph_snapdir_fops;935935extern const struct inode_operations ceph_dir_iops;936936extern const struct inode_operations ceph_snapdir_iops;937937-extern const struct dentry_operations ceph_dentry_ops, ceph_snap_dentry_ops,938938- ceph_snapdir_dentry_ops;937937+extern const struct dentry_operations ceph_dentry_ops;939938940939extern loff_t ceph_make_fpos(unsigned high, unsigned off, bool hash_order);941940extern int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry);···949950extern void ceph_invalidate_dentry_lease(struct dentry *dentry);950951extern unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn);951952extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl);952952-953953-/*954954- * our d_ops vary depending on whether the inode is live,955955- * snapshotted (read-only), or a virtual ".snap" directory.956956- */957957-int ceph_init_dentry(struct dentry *dentry);958958-959953960954/* ioctl.c */961955extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+54-93
fs/namei.c
···17251725 return 1;17261726}1727172717281728+enum {WALK_FOLLOW = 1, WALK_MORE = 2};17291729+17281730/*17291731 * Do we need to follow links? We _really_ want to be able17301732 * to do this check without having to look at inode->i_op,17311733 * so we keep a cache of "no, this doesn't need follow_link"17321734 * for the common case.17331735 */17341734-static inline int should_follow_link(struct nameidata *nd, struct path *link,17351735- int follow,17361736- struct inode *inode, unsigned seq)17361736+static inline int step_into(struct nameidata *nd, struct path *path,17371737+ int flags, struct inode *inode, unsigned seq)17371738{17381738- if (likely(!d_is_symlink(link->dentry)))17391739+ if (!(flags & WALK_MORE) && nd->depth)17401740+ put_link(nd);17411741+ if (likely(!d_is_symlink(path->dentry)) ||17421742+ !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW)) {17431743+ /* not a symlink or should not follow */17441744+ path_to_nameidata(path, nd);17451745+ nd->inode = inode;17461746+ nd->seq = seq;17391747 return 0;17401740- if (!follow)17411741- return 0;17481748+ }17421749 /* make sure that d_is_symlink above matches inode */17431750 if (nd->flags & LOOKUP_RCU) {17441744- if (read_seqcount_retry(&link->dentry->d_seq, seq))17511751+ if (read_seqcount_retry(&path->dentry->d_seq, seq))17451752 return -ECHILD;17461753 }17471747- return pick_link(nd, link, inode, seq);17541754+ return pick_link(nd, path, inode, seq);17481755}17491749-17501750-enum {WALK_GET = 1, WALK_PUT = 2};1751175617521757static int walk_component(struct nameidata *nd, int flags)17531758{···17671762 */17681763 if (unlikely(nd->last_type != LAST_NORM)) {17691764 err = handle_dots(nd, nd->last_type);17701770- if (flags & WALK_PUT)17651765+ if (!(flags & WALK_MORE) && nd->depth)17711766 put_link(nd);17721767 return err;17731768 }···17941789 inode = d_backing_inode(path.dentry);17951790 }1796179117971797- if (flags & WALK_PUT)17981798- put_link(nd);17991799- err = should_follow_link(nd, &path, flags & WALK_GET, inode, seq);18001800- if (unlikely(err))18011801- return err;18021802- path_to_nameidata(&path, nd);18031803- nd->inode = inode;18041804- nd->seq = seq;18051805- return 0;17921792+ return step_into(nd, &path, flags, inode, seq);18061793}1807179418081795/*···21012104 if (!name)21022105 return 0;21032106 /* last component of nested symlink */21042104- err = walk_component(nd, WALK_GET | WALK_PUT);21072107+ err = walk_component(nd, WALK_FOLLOW);21052108 } else {21062106- err = walk_component(nd, WALK_GET);21092109+ /* not the last component */21102110+ err = walk_component(nd, WALK_FOLLOW | WALK_MORE);21072111 }21082112 if (err < 0)21092113 return err;···22462248 nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;2247224922482250 nd->flags &= ~LOOKUP_PARENT;22492249- return walk_component(nd,22502250- nd->flags & LOOKUP_FOLLOW22512251- ? nd->depth22522252- ? WALK_PUT | WALK_GET22532253- : WALK_GET22542254- : 0);22512251+ return walk_component(nd, 0);22552252}2256225322572254/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */···25512558}25522559EXPORT_SYMBOL(user_path_at_empty);2553256025542554-/*25552555- * NB: most callers don't do anything directly with the reference to the25562556- * to struct filename, but the nd->last pointer points into the name string25572557- * allocated by getname. So we must hold the reference to it until all25582558- * path-walking is complete.25592559- */25602560-static inline struct filename *25612561-user_path_parent(int dfd, const char __user *path,25622562- struct path *parent,25632563- struct qstr *last,25642564- int *type,25652565- unsigned int flags)25662566-{25672567- /* only LOOKUP_REVAL is allowed in extra flags */25682568- return filename_parentat(dfd, getname(path), flags & LOOKUP_REVAL,25692569- parent, last, type);25702570-}25712571-25722561/**25732562 * mountpoint_last - look up last component for umount25742563 * @nd: pathwalk nameidata - currently pointing at parent directory of "last"25752575- * @path: pointer to container for result25762564 *25772565 * This is a special lookup_last function just for umount. In this case, we25782566 * need to resolve the path without doing any revalidation.···25662592 *25672593 * Returns:25682594 * -error: if there was an error during lookup. This includes -ENOENT if the25692569- * lookup found a negative dentry. The nd->path reference will also be25702570- * put in this case.25952595+ * lookup found a negative dentry.25712596 *25722572- * 0: if we successfully resolved nd->path and found it to not to be a25732573- * symlink that needs to be followed. "path" will also be populated.25742574- * The nd->path reference will also be put.25972597+ * 0: if we successfully resolved nd->last and found it to not to be a25982598+ * symlink that needs to be followed.25752599 *25762600 * 1: if we successfully resolved nd->last and found it to be a symlink25772577- * that needs to be followed. "path" will be populated with the path25782578- * to the link, and nd->path will *not* be put.26012601+ * that needs to be followed.25792602 */25802603static int25812581-mountpoint_last(struct nameidata *nd, struct path *path)26042604+mountpoint_last(struct nameidata *nd)25822605{25832606 int error = 0;25842584- struct dentry *dentry;25852607 struct dentry *dir = nd->path.dentry;26082608+ struct path path;2586260925872610 /* If we're in rcuwalk, drop out of it to handle last component */25882611 if (nd->flags & LOOKUP_RCU) {···25932622 error = handle_dots(nd, nd->last_type);25942623 if (error)25952624 return error;25962596- dentry = dget(nd->path.dentry);26252625+ path.dentry = dget(nd->path.dentry);25972626 } else {25982598- dentry = d_lookup(dir, &nd->last);25992599- if (!dentry) {26272627+ path.dentry = d_lookup(dir, &nd->last);26282628+ if (!path.dentry) {26002629 /*26012630 * No cached dentry. Mounted dentries are pinned in the26022631 * cache, so that means that this dentry is probably26032632 * a symlink or the path doesn't actually point26042633 * to a mounted dentry.26052634 */26062606- dentry = lookup_slow(&nd->last, dir,26352635+ path.dentry = lookup_slow(&nd->last, dir,26072636 nd->flags | LOOKUP_NO_REVAL);26082608- if (IS_ERR(dentry))26092609- return PTR_ERR(dentry);26372637+ if (IS_ERR(path.dentry))26382638+ return PTR_ERR(path.dentry);26102639 }26112640 }26122612- if (d_is_negative(dentry)) {26132613- dput(dentry);26412641+ if (d_is_negative(path.dentry)) {26422642+ dput(path.dentry);26142643 return -ENOENT;26152644 }26162616- if (nd->depth)26172617- put_link(nd);26182618- path->dentry = dentry;26192619- path->mnt = nd->path.mnt;26202620- error = should_follow_link(nd, path, nd->flags & LOOKUP_FOLLOW,26212621- d_backing_inode(dentry), 0);26222622- if (unlikely(error))26232623- return error;26242624- mntget(path->mnt);26252625- follow_mount(path);26262626- return 0;26452645+ path.mnt = nd->path.mnt;26462646+ return step_into(nd, &path, 0, d_backing_inode(path.dentry), 0);26272647}2628264826292649/**···26342672 if (IS_ERR(s))26352673 return PTR_ERR(s);26362674 while (!(err = link_path_walk(s, nd)) &&26372637- (err = mountpoint_last(nd, path)) > 0) {26752675+ (err = mountpoint_last(nd)) > 0) {26382676 s = trailing_symlink(nd);26392677 if (IS_ERR(s)) {26402678 err = PTR_ERR(s);26412679 break;26422680 }26812681+ }26822682+ if (!err) {26832683+ *path = nd->path;26842684+ nd->path.mnt = NULL;26852685+ nd->path.dentry = NULL;26862686+ follow_mount(path);26432687 }26442688 terminate_walk(nd);26452689 return err;···33033335 seq = 0; /* out of RCU mode, so the value doesn't matter */33043336 inode = d_backing_inode(path.dentry);33053337finish_lookup:33063306- if (nd->depth)33073307- put_link(nd);33083308- error = should_follow_link(nd, &path, nd->flags & LOOKUP_FOLLOW,33093309- inode, seq);33383338+ error = step_into(nd, &path, 0, inode, seq);33103339 if (unlikely(error))33113340 return error;33123312-33133313- path_to_nameidata(&path, nd);33143314- nd->inode = inode;33153315- nd->seq = seq;33163316- /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */33173341finish_open:33423342+ /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */33183343 error = complete_walk(nd);33193344 if (error)33203345 return error;···38223861 int type;38233862 unsigned int lookup_flags = 0;38243863retry:38253825- name = user_path_parent(dfd, pathname,38263826- &path, &last, &type, lookup_flags);38643864+ name = filename_parentat(dfd, getname(pathname), lookup_flags,38653865+ &path, &last, &type);38273866 if (IS_ERR(name))38283867 return PTR_ERR(name);38293868···39523991 struct inode *delegated_inode = NULL;39533992 unsigned int lookup_flags = 0;39543993retry:39553955- name = user_path_parent(dfd, pathname,39563956- &path, &last, &type, lookup_flags);39943994+ name = filename_parentat(dfd, getname(pathname), lookup_flags,39953995+ &path, &last, &type);39573996 if (IS_ERR(name))39583997 return PTR_ERR(name);39593998···44524491 target_flags = 0;4453449244544493retry:44554455- from = user_path_parent(olddfd, oldname,44564456- &old_path, &old_last, &old_type, lookup_flags);44944494+ from = filename_parentat(olddfd, getname(oldname), lookup_flags,44954495+ &old_path, &old_last, &old_type);44574496 if (IS_ERR(from)) {44584497 error = PTR_ERR(from);44594498 goto exit;44604499 }4461450044624462- to = user_path_parent(newdfd, newname,44634463- &new_path, &new_last, &new_type, lookup_flags);45014501+ to = filename_parentat(newdfd, getname(newname), lookup_flags,45024502+ &new_path, &new_last, &new_type);44644503 if (IS_ERR(to)) {44654504 error = PTR_ERR(to);44664505 goto exit1;