dir.c (4b841736bc16b320bcdb1e8ece585b3ced9a8811) dir.c (fab728e156b3cbfe31f05d6e7cdebe3d5eaff878)
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

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

1169}
1170
1171/*
1172 * Code common to create, mkdir, and mknod.
1173 */
1174int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1175 struct nfs_fattr *fattr)
1176{
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

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

1169}
1170
1171/*
1172 * Code common to create, mkdir, and mknod.
1173 */
1174int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
1175 struct nfs_fattr *fattr)
1176{
1177 struct dentry *parent = dget_parent(dentry);
1178 struct inode *dir = parent->d_inode;
1177 struct inode *inode;
1178 int error = -EACCES;
1179
1179 struct inode *inode;
1180 int error = -EACCES;
1181
1182 d_drop(dentry);
1183
1180 /* We may have been initialized further down */
1181 if (dentry->d_inode)
1184 /* We may have been initialized further down */
1185 if (dentry->d_inode)
1182 return 0;
1186 goto out;
1183 if (fhandle->size == 0) {
1187 if (fhandle->size == 0) {
1184 struct inode *dir = dentry->d_parent->d_inode;
1185 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr);
1186 if (error)
1188 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr);
1189 if (error)
1187 return error;
1190 goto out_error;
1188 }
1189 if (!(fattr->valid & NFS_ATTR_FATTR)) {
1190 struct nfs_server *server = NFS_SB(dentry->d_sb);
1191 error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr);
1192 if (error < 0)
1191 }
1192 if (!(fattr->valid & NFS_ATTR_FATTR)) {
1193 struct nfs_server *server = NFS_SB(dentry->d_sb);
1194 error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr);
1195 if (error < 0)
1193 return error;
1196 goto out_error;
1194 }
1195 inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
1196 error = PTR_ERR(inode);
1197 if (IS_ERR(inode))
1197 }
1198 inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
1199 error = PTR_ERR(inode);
1200 if (IS_ERR(inode))
1198 return error;
1199 d_instantiate(dentry, inode);
1200 if (d_unhashed(dentry))
1201 d_rehash(dentry);
1201 goto out_error;
1202 d_add(dentry, inode);
1203out:
1204 dput(parent);
1202 return 0;
1205 return 0;
1206out_error:
1207 nfs_mark_for_revalidate(dir);
1208 dput(parent);
1209 return error;
1203}
1204
1205/*
1206 * Following a failed create operation, we drop the dentry rather
1207 * than retain a negative dentry. This avoids a problem in the event
1208 * that the operation succeeded on the server, but an error in the
1209 * reply path made it appear to have failed.
1210 */

--- 802 unchanged lines hidden ---
1210}
1211
1212/*
1213 * Following a failed create operation, we drop the dentry rather
1214 * than retain a negative dentry. This avoids a problem in the event
1215 * that the operation succeeded on the server, but an error in the
1216 * reply path made it appear to have failed.
1217 */

--- 802 unchanged lines hidden ---