Skip to content

Commit

Permalink
Merge tag 'bcachefs-2024-02-05' of https://evilpiepirate.org/git/bcac…
Browse files Browse the repository at this point in the history
…hefs

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()
  • Loading branch information
Linus Torvalds committed Feb 6, 2024
2 parents 54be6c6 + 7b508b3 commit 99bd3cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fs/bcachefs/fs-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
if (IS_ERR(victim))
return PTR_ERR(victim);

dir = d_inode(path.dentry);
if (victim->d_sb->s_fs_info != c) {
ret = -EXDEV;
goto err;
Expand All @@ -463,14 +464,13 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
ret = -ENOENT;
goto err;
}
dir = d_inode(path.dentry);
ret = __bch2_unlink(dir, victim, true);
if (!ret) {
fsnotify_rmdir(dir, victim);
d_delete(victim);
}
inode_unlock(dir);
err:
inode_unlock(dir);
dput(victim);
path_put(&path);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion fs/bcachefs/mean_and_variance.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Rust and rustc has issues with u128.
*/

#if defined(__SIZEOF_INT128__) && defined(__KERNEL__)
#if defined(__SIZEOF_INT128__) && defined(__KERNEL__) && !defined(CONFIG_PARISC)

typedef struct {
unsigned __int128 v;
Expand Down
2 changes: 1 addition & 1 deletion fs/bcachefs/thread_with_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ int bch2_run_thread_with_file(struct thread_with_file *thr,
if (ret)
goto err;

fd_install(fd, file);
get_task_struct(thr->task);
wake_up_process(thr->task);
fd_install(fd, file);
return fd;
err:
if (fd >= 0)
Expand Down
5 changes: 3 additions & 2 deletions fs/bcachefs/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,15 @@ static inline void bch2_time_stats_update_one(struct bch2_time_stats *stats,
bch2_quantiles_update(&stats->quantiles, duration);
}

if (time_after64(end, stats->last_event)) {
if (stats->last_event && time_after64(end, stats->last_event)) {
freq = end - stats->last_event;
mean_and_variance_update(&stats->freq_stats, freq);
mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq);
stats->max_freq = max(stats->max_freq, freq);
stats->min_freq = min(stats->min_freq, freq);
stats->last_event = end;
}

stats->last_event = end;
}

static void __bch2_time_stats_clear_buffer(struct bch2_time_stats *stats,
Expand Down

0 comments on commit 99bd3cb

Please sign in to comment.