Framework for exporting system header to user space (#59)
[lunaix-os.git] / lunaix-os / kernel / fs / mount.c
index 282ae784ec2bdaa4a1ee12b0a32a7497dbb884b6..1dee55a1d946626b6bf95e903153fc48b7d54d46 100644 (file)
@@ -86,8 +86,8 @@ __vfs_do_unmount(struct v_mount* mnt)
 
     // detached the inodes from cache, and let lru policy to recycle them
     for (size_t i = 0; i < VFS_HASHTABLE_SIZE; i++) {
-        __detach_node_cache_ref(&sb->i_cache[i]);
-        __detach_node_cache_ref(&sb->d_cache[i]);
+        __detach_node_cache_ref(&sb->i_cache.pool[i]);
+        __detach_node_cache_ref(&sb->d_cache.pool[i]);
     }
 
     struct v_dnode *pos, *next;
@@ -293,6 +293,11 @@ vfs_check_writable(struct v_dnode* dnode)
     if ((dnode->mnt->flags & MNT_RO)) {
         return EROFS;
     }
+
+    if (!check_allow_write(dnode->inode)) {
+        return EPERM;
+    }
+
     return 0;
 }