Commit 99bd3cb0 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 54be6c6c 7b508b32
......@@ -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;
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment