Updated from Linux LTS 3.10.24 to 3.10.25
This commit is contained in:
@@ -227,7 +227,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
|
||||
if (ret > 0) {
|
||||
/* we need an acl */
|
||||
ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
|
||||
} else {
|
||||
} else if (ret < 0) {
|
||||
cache_no_acl(inode);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2419,10 +2419,23 @@ out_unlock:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void free_sa_defrag_extent(struct new_sa_defrag_extent *new)
|
||||
{
|
||||
struct old_sa_defrag_extent *old, *tmp;
|
||||
|
||||
if (!new)
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(old, tmp, &new->head, list) {
|
||||
list_del(&old->list);
|
||||
kfree(old);
|
||||
}
|
||||
kfree(new);
|
||||
}
|
||||
|
||||
static void relink_file_extents(struct new_sa_defrag_extent *new)
|
||||
{
|
||||
struct btrfs_path *path;
|
||||
struct old_sa_defrag_extent *old, *tmp;
|
||||
struct sa_defrag_extent_backref *backref;
|
||||
struct sa_defrag_extent_backref *prev = NULL;
|
||||
struct inode *inode;
|
||||
@@ -2465,16 +2478,11 @@ static void relink_file_extents(struct new_sa_defrag_extent *new)
|
||||
kfree(prev);
|
||||
|
||||
btrfs_free_path(path);
|
||||
|
||||
list_for_each_entry_safe(old, tmp, &new->head, list) {
|
||||
list_del(&old->list);
|
||||
kfree(old);
|
||||
}
|
||||
out:
|
||||
free_sa_defrag_extent(new);
|
||||
|
||||
atomic_dec(&root->fs_info->defrag_running);
|
||||
wake_up(&root->fs_info->transaction_wait);
|
||||
|
||||
kfree(new);
|
||||
}
|
||||
|
||||
static struct new_sa_defrag_extent *
|
||||
@@ -2484,7 +2492,7 @@ record_old_file_extents(struct inode *inode,
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_path *path;
|
||||
struct btrfs_key key;
|
||||
struct old_sa_defrag_extent *old, *tmp;
|
||||
struct old_sa_defrag_extent *old;
|
||||
struct new_sa_defrag_extent *new;
|
||||
int ret;
|
||||
|
||||
@@ -2532,7 +2540,7 @@ record_old_file_extents(struct inode *inode,
|
||||
if (slot >= btrfs_header_nritems(l)) {
|
||||
ret = btrfs_next_leaf(root, path);
|
||||
if (ret < 0)
|
||||
goto out_free_list;
|
||||
goto out_free_path;
|
||||
else if (ret > 0)
|
||||
break;
|
||||
continue;
|
||||
@@ -2561,7 +2569,7 @@ record_old_file_extents(struct inode *inode,
|
||||
|
||||
old = kmalloc(sizeof(*old), GFP_NOFS);
|
||||
if (!old)
|
||||
goto out_free_list;
|
||||
goto out_free_path;
|
||||
|
||||
offset = max(new->file_pos, key.offset);
|
||||
end = min(new->file_pos + new->len, key.offset + num_bytes);
|
||||
@@ -2583,15 +2591,10 @@ next:
|
||||
|
||||
return new;
|
||||
|
||||
out_free_list:
|
||||
list_for_each_entry_safe(old, tmp, &new->head, list) {
|
||||
list_del(&old->list);
|
||||
kfree(old);
|
||||
}
|
||||
out_free_path:
|
||||
btrfs_free_path(path);
|
||||
out_kfree:
|
||||
kfree(new);
|
||||
free_sa_defrag_extent(new);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2743,8 +2746,14 @@ out:
|
||||
btrfs_remove_ordered_extent(inode, ordered_extent);
|
||||
|
||||
/* for snapshot-aware defrag */
|
||||
if (new)
|
||||
relink_file_extents(new);
|
||||
if (new) {
|
||||
if (ret) {
|
||||
free_sa_defrag_extent(new);
|
||||
atomic_dec(&root->fs_info->defrag_running);
|
||||
} else {
|
||||
relink_file_extents(new);
|
||||
}
|
||||
}
|
||||
|
||||
/* once for us */
|
||||
btrfs_put_ordered_extent(ordered_extent);
|
||||
|
||||
@@ -2093,7 +2093,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
|
||||
|
||||
err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
|
||||
if (err == -EINTR)
|
||||
goto out;
|
||||
goto out_drop_write;
|
||||
dentry = lookup_one_len(vol_args->name, parent, namelen);
|
||||
if (IS_ERR(dentry)) {
|
||||
err = PTR_ERR(dentry);
|
||||
@@ -2235,6 +2235,7 @@ out_dput:
|
||||
dput(dentry);
|
||||
out_unlock_dir:
|
||||
mutex_unlock(&dir->i_mutex);
|
||||
out_drop_write:
|
||||
mnt_drop_write_file(file);
|
||||
out:
|
||||
kfree(vol_args);
|
||||
|
||||
@@ -4623,8 +4623,8 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
|
||||
}
|
||||
|
||||
if (!access_ok(VERIFY_READ, arg->clone_sources,
|
||||
sizeof(*arg->clone_sources *
|
||||
arg->clone_sources_count))) {
|
||||
sizeof(*arg->clone_sources) *
|
||||
arg->clone_sources_count)) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -3314,7 +3314,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_token_file_extent_type(leaf, fi,
|
||||
BTRFS_FILE_EXTENT_REG,
|
||||
&token);
|
||||
if (em->block_start == 0)
|
||||
if (em->block_start == EXTENT_MAP_HOLE)
|
||||
skip_csum = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4248,6 +4248,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
|
||||
btrfs_emerg(fs_info, "Invalid mapping for %Lu-%Lu, got "
|
||||
"%Lu-%Lu\n", logical, logical+len, em->start,
|
||||
em->start + em->len);
|
||||
free_extent_map(em);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4429,6 +4430,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
||||
btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
|
||||
"found %Lu-%Lu\n", logical, em->start,
|
||||
em->start + em->len);
|
||||
free_extent_map(em);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
static inline sector_t normalize(sector_t s, int base)
|
||||
{
|
||||
sector_t tmp = s; /* Since do_div modifies its argument */
|
||||
return s - do_div(tmp, base);
|
||||
return s - sector_div(tmp, base);
|
||||
}
|
||||
|
||||
static inline sector_t normalize_up(sector_t s, int base)
|
||||
|
||||
@@ -4222,8 +4222,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
|
||||
dprintk("%s ERROR %d, Reset session\n", __func__,
|
||||
task->tk_status);
|
||||
nfs4_schedule_session_recovery(clp->cl_session, task->tk_status);
|
||||
task->tk_status = 0;
|
||||
return -EAGAIN;
|
||||
goto wait_on_recovery;
|
||||
#endif /* CONFIG_NFS_V4_1 */
|
||||
case -NFS4ERR_DELAY:
|
||||
nfs_inc_server_stats(server, NFSIOS_DELAY);
|
||||
|
||||
@@ -128,6 +128,13 @@ nfsd_reply_cache_alloc(void)
|
||||
return rp;
|
||||
}
|
||||
|
||||
static void
|
||||
nfsd_reply_cache_unhash(struct svc_cacherep *rp)
|
||||
{
|
||||
hlist_del_init(&rp->c_hash);
|
||||
list_del_init(&rp->c_lru);
|
||||
}
|
||||
|
||||
static void
|
||||
nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
|
||||
{
|
||||
@@ -403,7 +410,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
|
||||
rp = list_first_entry(&lru_head, struct svc_cacherep, c_lru);
|
||||
if (nfsd_cache_entry_expired(rp) ||
|
||||
num_drc_entries >= max_drc_entries) {
|
||||
lru_put_end(rp);
|
||||
nfsd_reply_cache_unhash(rp);
|
||||
prune_cache_entries();
|
||||
goto search_cache;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,8 @@ xfs_growfs_data_private(
|
||||
*/
|
||||
nfree = 0;
|
||||
for (agno = nagcount - 1; agno >= oagcount; agno--, new -= agsize) {
|
||||
__be32 *agfl_bno;
|
||||
|
||||
/*
|
||||
* AG freespace header block
|
||||
*/
|
||||
@@ -275,8 +277,10 @@ xfs_growfs_data_private(
|
||||
agfl->agfl_seqno = cpu_to_be32(agno);
|
||||
uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_uuid);
|
||||
}
|
||||
|
||||
agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, bp);
|
||||
for (bucket = 0; bucket < XFS_AGFL_SIZE(mp); bucket++)
|
||||
agfl->agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK);
|
||||
agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK);
|
||||
|
||||
error = xfs_bwrite(bp);
|
||||
xfs_buf_relse(bp);
|
||||
|
||||
@@ -409,7 +409,8 @@ xfs_attrlist_by_handle(
|
||||
return -XFS_ERROR(EPERM);
|
||||
if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
|
||||
return -XFS_ERROR(EFAULT);
|
||||
if (al_hreq.buflen > XATTR_LIST_MAX)
|
||||
if (al_hreq.buflen < sizeof(struct attrlist) ||
|
||||
al_hreq.buflen > XATTR_LIST_MAX)
|
||||
return -XFS_ERROR(EINVAL);
|
||||
|
||||
/*
|
||||
|
||||
@@ -359,7 +359,8 @@ xfs_compat_attrlist_by_handle(
|
||||
if (copy_from_user(&al_hreq, arg,
|
||||
sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
|
||||
return -XFS_ERROR(EFAULT);
|
||||
if (al_hreq.buflen > XATTR_LIST_MAX)
|
||||
if (al_hreq.buflen < sizeof(struct attrlist) ||
|
||||
al_hreq.buflen > XATTR_LIST_MAX)
|
||||
return -XFS_ERROR(EINVAL);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user