From a9afa9248287f942108d8dd10f29787be9229125 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 20 Sep 2016 15:34:25 -0700 Subject: [PATCH] scoutfs: correctly set the last symlink item The final symlink item insertion was taking the min of the entire path and the max symlink item size, not the min of the remaining length of the path after having created all the previous items. For paths larger than the max item size this could use too much space. Signed-off-by: Zach Brown --- kmod/src/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 2b70dbee..13f51a7d 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -692,7 +692,7 @@ static int scoutfs_symlink(struct inode *dir, struct dentry *dentry, for (k = 0, off = 0; off < name_len; off += bytes, k++) { scoutfs_set_key(&key, scoutfs_ino(inode), SCOUTFS_SYMLINK_KEY, k); - bytes = min(name_len, SCOUTFS_MAX_ITEM_LEN); + bytes = min(name_len - off, SCOUTFS_MAX_ITEM_LEN); ret = scoutfs_btree_insert(sb, meta, &key, bytes, &curs); if (ret)