dir_lookup with O_CREAT on a synchronous mount writes out the directory
and the new node after diskfs_create_node, whether or not it succeeded.
When it fails (no space, no free inode, a quota), there is no new node,
and diskfs_file_update was called with a null pointer: any failed
create on a filesystem mounted with -s killed the translator.

Write out the new node only when there is one.
---
 libdiskfs/dir-lookup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 875036670..fd444be21 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -207,7 +207,9 @@ diskfs_S_dir_lookup (struct protid *dircred,
              if (diskfs_synchronous)
                {
                  diskfs_file_update (dnp, 1);
-                 diskfs_file_update (np, 1);
+                 /* A failed create leaves no node.  */
+                 if (!err)
+                   diskfs_file_update (np, 1);
                }
              newnode = 1;
            }
-- 
2.56.0


Reply via email to