From 9027775ef26f4b8c1e944913f95cbbd6895ae419 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 9 Oct 2017 10:42:03 -0700 Subject: [PATCH] scoutfs: fix parent dir nlink update in rename Renaming a dir between parents and clobbering an existing empty dir wasn't correctly updating the parent link counts. Updating parent link counts when dirs are moved between parents is an independent operation from decreasing the link count of a victim existing target of the rename. Signed-off-by: Zach Brown --- kmod/src/dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 8522f945..0813eec0 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1540,7 +1540,10 @@ retry: drop_nlink(new_dir); drop_nlink(new_inode); } - } else if (S_ISDIR(old_inode->i_mode) && (old_dir != new_dir)) { + + } + + if (S_ISDIR(old_inode->i_mode) && (old_dir != new_dir)) { drop_nlink(old_dir); inc_nlink(new_dir); }