You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/02/26 06:52:45 UTC

[2/2] incubator-mynewt-larva git commit: (MYNEWT-165) NFFS - Block collation during garbage collection can break parent file.

(MYNEWT-165) NFFS - Block collation during garbage collection can break parent file.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/a9291252
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/a9291252
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/a9291252

Branch: refs/heads/develop
Commit: a9291252f426690f29f3eca968ceb2040af4ceed
Parents: 12fa738
Author: Christopher Collins <cc...@gmail.com>
Authored: Thu Feb 25 21:14:24 2016 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Thu Feb 25 21:51:43 2016 -0800

----------------------------------------------------------------------
 fs/nffs/src/nffs_inode.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a9291252/fs/nffs/src/nffs_inode.c
----------------------------------------------------------------------
diff --git a/fs/nffs/src/nffs_inode.c b/fs/nffs/src/nffs_inode.c
index 969f5b0..6e330bf 100644
--- a/fs/nffs/src/nffs_inode.c
+++ b/fs/nffs/src/nffs_inode.c
@@ -215,7 +215,17 @@ nffs_inode_delete_blocks_from_ram(struct nffs_inode_entry *inode_entry)
 
     while (inode_entry->nie_last_block_entry != NULL) {
         rc = nffs_block_delete_from_ram(inode_entry->nie_last_block_entry);
-        if (rc != 0) {
+        if (rc == FS_ECORRUPT) {
+            /* The block references something that does not exist in RAM.  This
+             * is likely because the pointed-to object was in an area that has
+             * been garbage collected.  Terminate the delete procedure and
+             * report success.
+             */
+            /* XXX: This does not inspire confidence; the caller should somehow
+             * indicate that it expects this possibility.
+             */
+            inode_entry->nie_last_block_entry = NULL;
+        } else if (rc != 0) {
             return rc;
         }
     }