[rtems commit] dosfs: Fix for no space left on device condition

Gedare Bloom gedare at rtems.org
Fri Jan 12 21:01:25 UTC 2018


Module:    rtems
Branch:    4.10
Commit:    89dd2ec437d998aa617bc4a61258a0692e4721ff
Changeset: http://git.rtems.org/rtems/commit/?id=89dd2ec437d998aa617bc4a61258a0692e4721ff

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun Jun  3 13:06:51 2012 +0200

dosfs: Fix for no space left on device condition

The file size was wrong in the no space left on device condition.  This
resulted in turn in a read of an invalid block which lead to an EIO
error status.

---

 cpukit/libfs/src/dosfs/fat_file.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index 0cd5f28..8452ee8 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -532,9 +532,10 @@ fat_file_extend(
 
     /*  check wether we satisfied request for 'cls2add' clusters */
     if (cls2add != cls_added)
-        *a_length = new_length -
-                    ((cls2add - cls_added - 1) << fs_info->vol.bpc_log2) -
-                    (bytes2add & (fs_info->vol.bpc - 1));
+    {
+        new_length -= bytes2add & (fs_info->vol.bpc - 1);
+        new_length -= (cls2add - cls_added) << fs_info->vol.bpc_log2;
+    }
 
     /* add new chain to the end of existed */
     if ( fat_fd->fat_file_size == 0 )
@@ -583,6 +584,7 @@ fat_file_extend(
         }
     }
 
+    *a_length = new_length;
     fat_fd->fat_file_size = new_length;
 
     return RC_OK;




More information about the vc mailing list