fs/spiffs: Add a check for an error in a return value. Improve some working in the TODO list.

This commit is contained in:
Gregory Nutt 2018-09-29 17:19:04 -06:00
parent cc539d7f95
commit d23c5e0d61
2 changed files with 21 additions and 9 deletions

21
TODO
View File

@ -2081,13 +2081,20 @@ o File system / Generic drivers (fs/, drivers/)
to the file.
This error is probably not so significant in a real world
file system usage, but does cause the test at
apps/examples/fstest to fail. That test fails with an error
of a "Partial Read" because the file being read is smaller
than number bytes written to the file. This happens very
rarely on only may 1 out of 100 files and only if you write
constantly until the file system is full. The
configs/sim/spiffs test can used to demonstrate this error.
file system usage: It requires that you write continuously
to SPIFFS, never deleting files or freeing FLASH resources
in any way. And it requires the unlikely circumstance that
the final file written has its last few hundred bytes in
cache when the file is closed but there are even fewer bytes
available on the FLASH. That would be rare with a cache
size of a few hundred bytes and very large serial FLASH.
This issue does cause the test at apps/examples/fstest to
fail. That test fails with a "Partial Read" because the
file being read is smaller than number bytes written to the
file. That test does write small files continuously until
file system is full and even the the error is rare. The
configs/sim/spiffs test can used to demonstrate the error.
Status: Open
Priority: Medium. It is certain a file system failure, but I think that
the exposure in real world uses cases is very small.

View File

@ -1153,6 +1153,7 @@ static int spiffs_fstat(FAR const struct file *filep, FAR struct stat *buf)
FAR struct inode *inode;
FAR struct spiffs_s *fs;
FAR struct spiffs_file_s *fobj;
ssize_t nflushed;
int ret;
finfo("filep=%p buf=%p\n", filep, buf);
@ -1176,12 +1177,16 @@ static int spiffs_fstat(FAR const struct file *filep, FAR struct stat *buf)
/* Flush the cache and perform the common stat() operation */
spiffs_fobj_flush(fs, fobj);
nflushed = spiffs_fobj_flush(fs, fobj);
if (nflushed < 0)
{
ferr("ERROR: spiffs_fobj_flush() failed: %d\n", ret);
}
ret = spiffs_stat_pgndx(fs, fobj->objhdr_pgndx, fobj->objid, buf);
if (ret < 0)
{
ferr("ERROR: spiffs_stat_pgndx failed: %d\n", ret);
ferr("ERROR: spiffs_stat_pgndx() failed: %d\n", ret);
}
spiffs_unlock_volume(fs);