[PATCH] ubifs: return ENOSPC if running out of inode number

Richard Weinberger richard at nod.at
Tue Feb 7 01:25:03 PST 2017


Sheng Yong,

Am 07.02.2017 um 09:19 schrieb Sheng Yong:
>> Can you please explain *why* this has to be changed to -ENOSPC?
> Hi, Richard,
> 
> This is a trivial change. I think if there is not enough inode number available,
> it means the filesystem has no room for the new file. So ENOSPC may be appropriate,
> and some others filesystems returns ENOSPC in such scenario :)

It is less trivial than you might think.
UBIFS cannot reuse inode numbers, as soon you reach INUM_WATERMARK
the filesystem is more or less dead. -ENOSPC indicates that the user
can produce free space by deleting files, which will *not* help.
That's why we use -EINVAL in terms of "we are in bad state". :)

Unless you can show me an actual breakage because of -EINVAL instead
of -ENOSPC I'd keep it as-is.
Did you hit that code path? It is more likely to wear out the flash
long before you hit that limit.

Thanks,
//richard



More information about the linux-mtd mailing list