Message ID | 20240722133320.835470-1-maharmstone@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] btrfs-progs: set transid in btrfs_insert_dir_item | expand |
On Mon, Jul 22, 2024 at 02:33:02PM +0100, Mark Harmstone wrote: > btrfs_insert_dir_item wasn't setting the transid field in > btrfs_dir_item. Set it to the current transaction ID rather than writing > uninitialized memory to disk. > > Signed-off-by: Mark Harmstone <maharmstone@fb.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Thanks, Josef
在 2024/7/22 23:03, Mark Harmstone 写道: > btrfs_insert_dir_item wasn't setting the transid field in > btrfs_dir_item. Set it to the current transaction ID rather than writing > uninitialized memory to disk. > > Signed-off-by: Mark Harmstone <maharmstone@fb.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > kernel-shared/dir-item.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel-shared/dir-item.c b/kernel-shared/dir-item.c > index 4c62597b..5e7d09e6 100644 > --- a/kernel-shared/dir-item.c > +++ b/kernel-shared/dir-item.c > @@ -27,6 +27,7 @@ > #include "kernel-shared/accessors.h" > #include "kernel-shared/extent_io.h" > #include "kernel-shared/uapi/btrfs_tree.h" > +#include "kernel-shared/transaction.h" > > struct btrfs_trans_handle; > > @@ -173,6 +174,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root > btrfs_set_dir_flags(leaf, dir_item, type); > btrfs_set_dir_data_len(leaf, dir_item, 0); > btrfs_set_dir_name_len(leaf, dir_item, name_len); > + btrfs_set_dir_transid(leaf, dir_item, trans->transid); > name_ptr = (unsigned long)(dir_item + 1); > > write_extent_buffer(leaf, name, name_ptr, name_len); > @@ -202,6 +204,7 @@ insert: > btrfs_set_dir_flags(leaf, dir_item, type); > btrfs_set_dir_data_len(leaf, dir_item, 0); > btrfs_set_dir_name_len(leaf, dir_item, name_len); > + btrfs_set_dir_transid(leaf, dir_item, trans->transid); > name_ptr = (unsigned long)(dir_item + 1); > write_extent_buffer(leaf, name, name_ptr, name_len); > btrfs_mark_buffer_dirty(leaf);
On Mon, Jul 22, 2024 at 02:33:02PM +0100, Mark Harmstone wrote: > btrfs_insert_dir_item wasn't setting the transid field in > btrfs_dir_item. Set it to the current transaction ID rather than writing > uninitialized memory to disk. > > Signed-off-by: Mark Harmstone <maharmstone@fb.com> Qu merged it to devel, thanks.
diff --git a/kernel-shared/dir-item.c b/kernel-shared/dir-item.c index 4c62597b..5e7d09e6 100644 --- a/kernel-shared/dir-item.c +++ b/kernel-shared/dir-item.c @@ -27,6 +27,7 @@ #include "kernel-shared/accessors.h" #include "kernel-shared/extent_io.h" #include "kernel-shared/uapi/btrfs_tree.h" +#include "kernel-shared/transaction.h" struct btrfs_trans_handle; @@ -173,6 +174,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root btrfs_set_dir_flags(leaf, dir_item, type); btrfs_set_dir_data_len(leaf, dir_item, 0); btrfs_set_dir_name_len(leaf, dir_item, name_len); + btrfs_set_dir_transid(leaf, dir_item, trans->transid); name_ptr = (unsigned long)(dir_item + 1); write_extent_buffer(leaf, name, name_ptr, name_len); @@ -202,6 +204,7 @@ insert: btrfs_set_dir_flags(leaf, dir_item, type); btrfs_set_dir_data_len(leaf, dir_item, 0); btrfs_set_dir_name_len(leaf, dir_item, name_len); + btrfs_set_dir_transid(leaf, dir_item, trans->transid); name_ptr = (unsigned long)(dir_item + 1); write_extent_buffer(leaf, name, name_ptr, name_len); btrfs_mark_buffer_dirty(leaf);
btrfs_insert_dir_item wasn't setting the transid field in btrfs_dir_item. Set it to the current transaction ID rather than writing uninitialized memory to disk. Signed-off-by: Mark Harmstone <maharmstone@fb.com> --- kernel-shared/dir-item.c | 3 +++ 1 file changed, 3 insertions(+)