NFS file unlink operation.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 14 Sep 2009 17:44:10 +0000 (10:44 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Mon, 14 Sep 2009 17:44:10 +0000 (10:44 -0700)
bluesky/dir.c
bluesky/inode.c
nfs3/nfs3.c

index 2690498..f9fd8bc 100644 (file)
@@ -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;
index 8faafa4..59b915a 100644 (file)
@@ -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);
     }
 
index 1b83181..aabac28 100644 (file)
@@ -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;
 }