Skip to content

Commit 41a75a6

Browse files
committed
Merge branch 'for-chris-4.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.11
2 parents e1699d2 + 457ae72 commit 41a75a6

File tree

6 files changed

+44
-29
lines changed

6 files changed

+44
-29
lines changed

fs/btrfs/ctree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ struct btrfs_root {
12581258
atomic_t will_be_snapshoted;
12591259

12601260
/* For qgroup metadata space reserve */
1261-
atomic_t qgroup_meta_rsv;
1261+
atomic64_t qgroup_meta_rsv;
12621262
};
12631263
static inline u32 btrfs_inode_sectorsize(const struct inode *inode)
12641264
{

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
13421342
atomic_set(&root->orphan_inodes, 0);
13431343
atomic_set(&root->refs, 1);
13441344
atomic_set(&root->will_be_snapshoted, 0);
1345-
atomic_set(&root->qgroup_meta_rsv, 0);
1345+
atomic64_set(&root->qgroup_meta_rsv, 0);
13461346
root->log_transid = 0;
13471347
root->log_transid_committed = -1;
13481348
root->last_log_commit = 0;

fs/btrfs/extent_io.c

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,26 +2584,36 @@ static void end_bio_extent_readpage(struct bio *bio)
25842584

25852585
if (tree->ops) {
25862586
ret = tree->ops->readpage_io_failed_hook(page, mirror);
2587-
if (!ret && !bio->bi_error)
2588-
uptodate = 1;
2589-
} else {
2587+
if (ret == -EAGAIN) {
2588+
/*
2589+
* Data inode's readpage_io_failed_hook() always
2590+
* returns -EAGAIN.
2591+
*
2592+
* The generic bio_readpage_error handles errors
2593+
* the following way: If possible, new read
2594+
* requests are created and submitted and will
2595+
* end up in end_bio_extent_readpage as well (if
2596+
* we're lucky, not in the !uptodate case). In
2597+
* that case it returns 0 and we just go on with
2598+
* the next page in our bio. If it can't handle
2599+
* the error it will return -EIO and we remain
2600+
* responsible for that page.
2601+
*/
2602+
ret = bio_readpage_error(bio, offset, page,
2603+
start, end, mirror);
2604+
if (ret == 0) {
2605+
uptodate = !bio->bi_error;
2606+
offset += len;
2607+
continue;
2608+
}
2609+
}
2610+
25902611
/*
2591-
* The generic bio_readpage_error handles errors the
2592-
* following way: If possible, new read requests are
2593-
* created and submitted and will end up in
2594-
* end_bio_extent_readpage as well (if we're lucky, not
2595-
* in the !uptodate case). In that case it returns 0 and
2596-
* we just go on with the next page in our bio. If it
2597-
* can't handle the error it will return -EIO and we
2598-
* remain responsible for that page.
2612+
* metadata's readpage_io_failed_hook() always returns
2613+
* -EIO and fixes nothing. -EIO is also returned if
2614+
* data inode error could not be fixed.
25992615
*/
2600-
ret = bio_readpage_error(bio, offset, page, start, end,
2601-
mirror);
2602-
if (ret == 0) {
2603-
uptodate = !bio->bi_error;
2604-
offset += len;
2605-
continue;
2606-
}
2616+
ASSERT(ret == -EIO);
26072617
}
26082618
readpage_ok:
26092619
if (likely(uptodate)) {

fs/btrfs/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10523,9 +10523,9 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
1052310523
}
1052410524

1052510525
__attribute__((const))
10526-
static int dummy_readpage_io_failed_hook(struct page *page, int failed_mirror)
10526+
static int btrfs_readpage_io_failed_hook(struct page *page, int failed_mirror)
1052710527
{
10528-
return 0;
10528+
return -EAGAIN;
1052910529
}
1053010530

1053110531
static const struct inode_operations btrfs_dir_inode_operations = {
@@ -10570,7 +10570,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
1057010570
.submit_bio_hook = btrfs_submit_bio_hook,
1057110571
.readpage_end_io_hook = btrfs_readpage_end_io_hook,
1057210572
.merge_bio_hook = btrfs_merge_bio_hook,
10573-
.readpage_io_failed_hook = dummy_readpage_io_failed_hook,
10573+
.readpage_io_failed_hook = btrfs_readpage_io_failed_hook,
1057410574

1057510575
/* optional callbacks */
1057610576
.fill_delalloc = run_delalloc_range,

fs/btrfs/qgroup.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,20 +2948,20 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
29482948
ret = qgroup_reserve(root, num_bytes, enforce);
29492949
if (ret < 0)
29502950
return ret;
2951-
atomic_add(num_bytes, &root->qgroup_meta_rsv);
2951+
atomic64_add(num_bytes, &root->qgroup_meta_rsv);
29522952
return ret;
29532953
}
29542954

29552955
void btrfs_qgroup_free_meta_all(struct btrfs_root *root)
29562956
{
29572957
struct btrfs_fs_info *fs_info = root->fs_info;
2958-
int reserved;
2958+
u64 reserved;
29592959

29602960
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags) ||
29612961
!is_fstree(root->objectid))
29622962
return;
29632963

2964-
reserved = atomic_xchg(&root->qgroup_meta_rsv, 0);
2964+
reserved = atomic64_xchg(&root->qgroup_meta_rsv, 0);
29652965
if (reserved == 0)
29662966
return;
29672967
btrfs_qgroup_free_refroot(fs_info, root->objectid, reserved);
@@ -2976,8 +2976,8 @@ void btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes)
29762976
return;
29772977

29782978
BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
2979-
WARN_ON(atomic_read(&root->qgroup_meta_rsv) < num_bytes);
2980-
atomic_sub(num_bytes, &root->qgroup_meta_rsv);
2979+
WARN_ON(atomic64_read(&root->qgroup_meta_rsv) < num_bytes);
2980+
atomic64_sub(num_bytes, &root->qgroup_meta_rsv);
29812981
btrfs_qgroup_free_refroot(fs_info, root->objectid, num_bytes);
29822982
}
29832983

fs/btrfs/send.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6305,8 +6305,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
63056305
goto out;
63066306
}
63076307

6308+
/*
6309+
* Check that we don't overflow at later allocations, we request
6310+
* clone_sources_count + 1 items, and compare to unsigned long inside
6311+
* access_ok.
6312+
*/
63086313
if (arg->clone_sources_count >
6309-
ULLONG_MAX / sizeof(*arg->clone_sources)) {
6314+
ULONG_MAX / sizeof(struct clone_root) - 1) {
63106315
ret = -EINVAL;
63116316
goto out;
63126317
}

0 commit comments

Comments
 (0)