From: Michael Vrable Date: Mon, 14 Sep 2009 17:44:10 +0000 (-0700) Subject: NFS file unlink operation. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=0a6dbd76f58caad61a494a64e9bd421de61f6aa6;p=bluesky.git NFS file unlink operation. --- diff --git a/bluesky/dir.c b/bluesky/dir.c index 2690498..f9fd8bc 100644 --- a/bluesky/dir.c +++ b/bluesky/dir.c @@ -122,8 +122,6 @@ gboolean bluesky_directory_remove(BlueSkyInode *dir, gchar *name) g_sequence_remove(i); - bluesky_dirent_destroy(d); - bluesky_inode_update_ctime(dir, 1); return TRUE; diff --git a/bluesky/inode.c b/bluesky/inode.c index 8faafa4..59b915a 100644 --- a/bluesky/inode.c +++ b/bluesky/inode.c @@ -145,7 +145,6 @@ BlueSkyInode *bluesky_get_inode(BlueSkyFS *fs, uint64_t inum) } if (inode != NULL) { - g_mutex_lock(inode->lock); bluesky_inode_ref(inode); } diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index 1b83181..aabac28 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -488,7 +488,31 @@ nfsproc3_remove_3_svc(diropargs3 *argp, struct svc_req *rqstp) { static wccstat3 result; - result.status = NFS3ERR_NOTSUPP; + result.wccstat3_u.wcc.before.present = FALSE; + result.wccstat3_u.wcc.after.present = FALSE; + + BlueSkyInode *dir = lookup_fh(&argp->dir); + if (dir == NULL) { + result.status = NFS3ERR_STALE; + return &result; + } + + encode_pre_wcc(&result.wccstat3_u.wcc, dir); + + if (!validate_filename(argp->name) + || strcmp(argp->name, ".") == 0 + || strcmp(argp->name, "..") == 0) + { + result.status = NFS3ERR_NOENT; + return &result; + } + + bluesky_directory_remove(dir, argp->name); + + result.status = NFS3_OK; + result.wccstat3_u.wcc.after.present = TRUE; + encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes, + dir); return &result; }