On Wed, Jun 26, 2013 at 10:02:05AM -0400, Theodore Ts'o wrote: > > In this particular case, we could reflect the error all the way up to > the ftruncate(2) system call. Fixing this is going to be a bit > involved, unfortunately; we'll need to update a fairly large number of > function signatures, including ext4_truncate(), ext4_ext_truncate(), > ext4_free_blocks(), and a number of others. One thing that comes to mind. If we change things so that ftruncate reflects an ENOMEM error all the way up to userspace, one side effect of this is that the file may be partially truncated when ENOMEM is returned. Applications may not be prepared for this. There would be a similar issue if we do the truncate in the unlink call and return ENOMEM in case of a failure, the file might not be unlinked, and in fact we might have a partially truncated file in the directory, which would probably cause all sorts of confusion. So we're probably better off, putting the inode on a list of inodes in memory, and on the orphan list on disk, and then retry the truncation when memory is available. Messy, but that probably gives the best result for applications living constantly in high memory pressure environments. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html