[PATCH v3 4/7] Btrfs: incremental send, fix orphan_dir_info leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's one case where we leak a orphan_dir_info structure.

Example:

Parent snapshot:
|---- a/ (ino 279)
    |---- c (ino 282)
|---- del/ (ino 281)
    |---- tmp/ (ino 280)
    |---- long/ (ino 283)
    |---- longlong/ (ino 284)

Send snapshot:
|---- a/ (ino 279)
    |---- long (ino 283)
    |---- longlong (ino 284)
|---- c/ (ino 282)
    |---- tmp/ (ino 280)

Freeing an existing orphan_dir_info for a directory, when we realize
we can't rmdir the directory because it has a descendant that wasn't
yet processed, and the orphan_dir_info was created because it had a
descendant that had its rename operation delayed.

Signed-off-by: Robbie Ko <robbieko@xxxxxxxxxxxx>
---
 fs/btrfs/send.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index ca8cb87..194df76 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2914,6 +2914,11 @@ static int can_rmdir(struct send_ctx *sctx, u64 dir, u64 dir_gen,
 		}
 
 		if (loc.objectid > send_progress) {
+			struct orphan_dir_info *odi;
+
+			odi = get_orphan_dir_info(sctx, dir);
+			if (odi)
+				free_orphan_dir_info(sctx, odi);
 			ret = 0;
 			goto out;
 		}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux