]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/btrfs/inode.c
btrfs: set last dir index to the current last index when opening dir
[thirdparty/linux.git] / fs / btrfs / inode.c
index 616fdcf40467e930cfe6f8fb31bd391a8c309382..dee4fce6ab7267b7a5c533798f1f0fe96a138dbc 100644 (file)
@@ -5780,7 +5780,8 @@ static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
                }
        }
 
-       *index = dir->index_cnt;
+       /* index_cnt is the index number of next new entry, so decrement it. */
+       *index = dir->index_cnt - 1;
 
        return 0;
 }