AnsweredAssumed Answered

MFS on MQX 4.2 problem when multiple files with common name root in same directory

Question asked by Luiz Fernando Schrickte on Jul 27, 2015
Latest reply on Sep 1, 2015 by Joseph Chen

Hi folks,


I'm getting a strange behavior on MFS on MQX 4.2 - which was not occurring on MQX 4.1.


I am writing logs to a log directory (a:/log) on the SD card, sequentially: every time a log file reaches some fixed size a new file is created. Log filenames follow this pattern:  logN.txt


I've noticed however that, after a certain number of logs are created (it looks like the magical number is 127), if I close the file handle and try to open it again I get a "file not found" error. Even the shell "del" command doesn't work with this file (however I can mount the filesystem normally on windows and delete the file).


I've tried to debug the mfs code and it looks like it is failing on LFN calculations on the MFS_scan_dir_chain function (file mfs_dir_chain.c) - it returns file not found error - even the file being in there.


Another clue is that if I delete the previous file (log126.txt, as I can't delete log127.txt) the following returns from a dir command:


Shell default dir command response




LOG115.TXT        136 07-27-2015 19:51:40      A LOG115.TXT

LOG116.TXT        136 07-27-2015 19:51:42      A LOG116.TXT

LOG117.TXT        134 07-27-2015 19:51:42      A LOG117.TXT

LOG118.TXT        140 07-27-2015 19:51:42      A LOG118.TXT

LOG119.TXT        136 07-27-2015 19:51:42      A LOG119.TXT

LOG120.TXT        136 07-27-2015 19:51:44      A LOG120.TXT

LOG121.TXT        134 07-27-2015 20:23:18      A LOG121.TXT

LOG122.TXT        132 07-27-2015 20:23:22      A LOG122.TXT

LOG123.TXT        130 07-27-2015 20:23:28      A LOG123.TXT

LOG124.TXT        128 07-27-2015 20:23:38      A LOG124.TXT

LOG125.TXT        134 07-27-2015 20:23:52      A LOG125.TXT

14380240.29, 858797106 09-20-2005 06:08:20  HS DA 14380240.29,


There is some garbage at the listing end. I'm not sure that both problems are related, though.


I've tried different SD cards already and also tried to delete all files, however the problem is always there again!


Thanks in advance - any help will be appreciated!