dir.c (77a55a1fe8f26f7d022986a599b68002e21d968a) dir.c (8fb559f87fee7f71dbf9a595095ad7d8e84c55e7)
1/*
2 * linux/fs/nfs/dir.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs directory handling functions
7 *
8 * 10 Apr 1996 Added silly rename for unlink --okir

--- 652 unchanged lines hidden (view full) ---

661 return 1;
662}
663
664static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
665{
666 dentry->d_time = verf;
667}
668
1/*
2 * linux/fs/nfs/dir.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs directory handling functions
7 *
8 * 10 Apr 1996 Added silly rename for unlink --okir

--- 652 unchanged lines hidden (view full) ---

661 return 1;
662}
663
664static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
665{
666 dentry->d_time = verf;
667}
668
669static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf)
670{
671 nfs_set_verifier(dentry, verf);
672}
673
674/*
675 * Return the intent data that applies to this particular path component
676 *
677 * Note that the current set of intents only apply to the very last
678 * component of the path.
679 * We check for this using LOOKUP_CONTINUE and LOOKUP_PARENT.
680 */
681static inline unsigned int nfs_lookup_check_intent(struct nameidata *nd, unsigned int mask)

--- 107 unchanged lines hidden (view full) ---

789 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
790 if (error)
791 goto out_bad;
792 if (nfs_compare_fh(NFS_FH(inode), &fhandle))
793 goto out_bad;
794 if ((error = nfs_refresh_inode(inode, &fattr)) != 0)
795 goto out_bad;
796
669/*
670 * Return the intent data that applies to this particular path component
671 *
672 * Note that the current set of intents only apply to the very last
673 * component of the path.
674 * We check for this using LOOKUP_CONTINUE and LOOKUP_PARENT.
675 */
676static inline unsigned int nfs_lookup_check_intent(struct nameidata *nd, unsigned int mask)

--- 107 unchanged lines hidden (view full) ---

784 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
785 if (error)
786 goto out_bad;
787 if (nfs_compare_fh(NFS_FH(inode), &fhandle))
788 goto out_bad;
789 if ((error = nfs_refresh_inode(inode, &fattr)) != 0)
790 goto out_bad;
791
797 nfs_refresh_verifier(dentry, verifier);
792 nfs_set_verifier(dentry, verifier);
798 out_valid:
799 unlock_kernel();
800 dput(parent);
801 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n",
802 __FUNCTION__, dentry->d_parent->d_name.name,
803 dentry->d_name.name);
804 return 1;
805out_zap_parent:

--- 282 unchanged lines hidden (view full) ---

1088 * Note: we're not holding inode->i_mutex and so may be racing with
1089 * operations that change the directory. We therefore save the
1090 * change attribute *before* we do the RPC call.
1091 */
1092 lock_kernel();
1093 verifier = nfs_save_change_attribute(dir);
1094 ret = nfs4_open_revalidate(dir, dentry, openflags, nd);
1095 if (!ret)
793 out_valid:
794 unlock_kernel();
795 dput(parent);
796 dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n",
797 __FUNCTION__, dentry->d_parent->d_name.name,
798 dentry->d_name.name);
799 return 1;
800out_zap_parent:

--- 282 unchanged lines hidden (view full) ---

1083 * Note: we're not holding inode->i_mutex and so may be racing with
1084 * operations that change the directory. We therefore save the
1085 * change attribute *before* we do the RPC call.
1086 */
1087 lock_kernel();
1088 verifier = nfs_save_change_attribute(dir);
1089 ret = nfs4_open_revalidate(dir, dentry, openflags, nd);
1090 if (!ret)
1096 nfs_refresh_verifier(dentry, verifier);
1091 nfs_set_verifier(dentry, verifier);
1097 unlock_kernel();
1098out:
1099 dput(parent);
1100 if (!ret)
1101 d_drop(dentry);
1102 return ret;
1103no_open:
1104 dput(parent);

--- 59 unchanged lines hidden (view full) ---

1164 alias = d_materialise_unique(dentry, inode);
1165 if (alias != NULL) {
1166 dput(dentry);
1167 if (IS_ERR(alias))
1168 return NULL;
1169 dentry = alias;
1170 }
1171
1092 unlock_kernel();
1093out:
1094 dput(parent);
1095 if (!ret)
1096 d_drop(dentry);
1097 return ret;
1098no_open:
1099 dput(parent);

--- 59 unchanged lines hidden (view full) ---

1159 alias = d_materialise_unique(dentry, inode);
1160 if (alias != NULL) {
1161 dput(dentry);
1162 if (IS_ERR(alias))
1163 return NULL;
1164 dentry = alias;
1165 }
1166
1167out_renew:
1172 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1173 return dentry;
1168 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1169 return dentry;
1174out_renew:
1175 nfs_refresh_verifier(dentry, nfs_save_change_attribute(dir));
1176 return dentry;
1177}
1178
1179/*
1180 * Code common to create, mkdir, and mknod.
1181 */
1182int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1183 struct nfs_fattr *fattr)
1184{

--- 505 unchanged lines hidden (view full) ---

1690 nfs_end_data_update(old_inode);
1691 nfs_end_data_update(new_dir);
1692 nfs_end_data_update(old_dir);
1693out:
1694 if (rehash)
1695 d_rehash(rehash);
1696 if (!error) {
1697 d_move(old_dentry, new_dentry);
1170}
1171
1172/*
1173 * Code common to create, mkdir, and mknod.
1174 */
1175int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1176 struct nfs_fattr *fattr)
1177{

--- 505 unchanged lines hidden (view full) ---

1683 nfs_end_data_update(old_inode);
1684 nfs_end_data_update(new_dir);
1685 nfs_end_data_update(old_dir);
1686out:
1687 if (rehash)
1688 d_rehash(rehash);
1689 if (!error) {
1690 d_move(old_dentry, new_dentry);
1698 nfs_refresh_verifier(new_dentry, nfs_save_change_attribute(new_dir));
1691 nfs_set_verifier(new_dentry,
1692 nfs_save_change_attribute(new_dir));
1699 }
1700
1701 /* new dentry created? */
1702 if (dentry)
1703 dput(dentry);
1704 unlock_kernel();
1705 return error;
1706}

--- 295 unchanged lines hidden ---
1693 }
1694
1695 /* new dentry created? */
1696 if (dentry)
1697 dput(dentry);
1698 unlock_kernel();
1699 return error;
1700}

--- 295 unchanged lines hidden ---