Skip to content

Commit 99bd3cb

Browse files
committed
Merge tag 'bcachefs-2024-02-05' of https://evilpiepirate.org/git/bcachefs
Pull bcachefs fixes from Kent Overstreet: "Two serious ones here that we'll want to backport to stable: a fix for a race in the thread_with_file code, and another locking fixup in the subvolume deletion path" * tag 'bcachefs-2024-02-05' of https://evilpiepirate.org/git/bcachefs: bcachefs: time_stats: Check for last_event == 0 when updating freq stats bcachefs: install fd later to avoid race with close bcachefs: unlock parent dir if entry is not found in subvolume deletion bcachefs: Fix build on parisc by avoiding __multi3()
2 parents 54be6c6 + 7b508b3 commit 99bd3cb

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

fs/bcachefs/fs-ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
455455
if (IS_ERR(victim))
456456
return PTR_ERR(victim);
457457

458+
dir = d_inode(path.dentry);
458459
if (victim->d_sb->s_fs_info != c) {
459460
ret = -EXDEV;
460461
goto err;
@@ -463,14 +464,13 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
463464
ret = -ENOENT;
464465
goto err;
465466
}
466-
dir = d_inode(path.dentry);
467467
ret = __bch2_unlink(dir, victim, true);
468468
if (!ret) {
469469
fsnotify_rmdir(dir, victim);
470470
d_delete(victim);
471471
}
472-
inode_unlock(dir);
473472
err:
473+
inode_unlock(dir);
474474
dput(victim);
475475
path_put(&path);
476476
return ret;

fs/bcachefs/mean_and_variance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Rust and rustc has issues with u128.
1818
*/
1919

20-
#if defined(__SIZEOF_INT128__) && defined(__KERNEL__)
20+
#if defined(__SIZEOF_INT128__) && defined(__KERNEL__) && !defined(CONFIG_PARISC)
2121

2222
typedef struct {
2323
unsigned __int128 v;

fs/bcachefs/thread_with_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ int bch2_run_thread_with_file(struct thread_with_file *thr,
5353
if (ret)
5454
goto err;
5555

56-
fd_install(fd, file);
5756
get_task_struct(thr->task);
5857
wake_up_process(thr->task);
58+
fd_install(fd, file);
5959
return fd;
6060
err:
6161
if (fd >= 0)

fs/bcachefs/util.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,15 @@ static inline void bch2_time_stats_update_one(struct bch2_time_stats *stats,
418418
bch2_quantiles_update(&stats->quantiles, duration);
419419
}
420420

421-
if (time_after64(end, stats->last_event)) {
421+
if (stats->last_event && time_after64(end, stats->last_event)) {
422422
freq = end - stats->last_event;
423423
mean_and_variance_update(&stats->freq_stats, freq);
424424
mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq);
425425
stats->max_freq = max(stats->max_freq, freq);
426426
stats->min_freq = min(stats->min_freq, freq);
427-
stats->last_event = end;
428427
}
428+
429+
stats->last_event = end;
429430
}
430431

431432
static void __bch2_time_stats_clear_buffer(struct bch2_time_stats *stats,

0 commit comments

Comments
 (0)