Merge tag 'v3.10.106' into update
This is the 3.10.106 stable release
This commit is contained in:
+6
-6
@@ -334,12 +334,12 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
|
||||
value = NULL;
|
||||
size = 0;
|
||||
}
|
||||
iattr.ia_valid = ATTR_MODE;
|
||||
/* FIXME should we update ctime ?
|
||||
* What is the following setxattr update the
|
||||
* mode ?
|
||||
*/
|
||||
v9fs_vfs_setattr_dotl(dentry, &iattr);
|
||||
iattr.ia_valid = ATTR_MODE;
|
||||
/* FIXME should we update ctime ?
|
||||
* What is the following setxattr update the
|
||||
* mode ?
|
||||
*/
|
||||
v9fs_vfs_setattr_dotl(dentry, &iattr);
|
||||
}
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
||||
+7
-2
@@ -655,7 +655,7 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
|
||||
return true; /* already a holder */
|
||||
else if (bdev->bd_holder != NULL)
|
||||
return false; /* held by someone else */
|
||||
else if (bdev->bd_contains == bdev)
|
||||
else if (whole == bdev)
|
||||
return true; /* is a whole device which isn't held */
|
||||
|
||||
else if (whole->bd_holder == bd_may_claim)
|
||||
@@ -1696,6 +1696,7 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
|
||||
spin_lock(&inode_sb_list_lock);
|
||||
list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list) {
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
struct block_device *bdev;
|
||||
|
||||
spin_lock(&inode->i_lock);
|
||||
if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) ||
|
||||
@@ -1716,8 +1717,12 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
|
||||
*/
|
||||
iput(old_inode);
|
||||
old_inode = inode;
|
||||
bdev = I_BDEV(inode);
|
||||
|
||||
func(I_BDEV(inode), arg);
|
||||
mutex_lock(&bdev->bd_mutex);
|
||||
if (bdev->bd_openers)
|
||||
func(bdev, arg);
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
|
||||
spin_lock(&inode_sb_list_lock);
|
||||
}
|
||||
|
||||
+1
-2
@@ -1691,12 +1691,11 @@ static noinline int find_dir_range(struct btrfs_root *root,
|
||||
next:
|
||||
/* check the next slot in the tree to see if it is a valid item */
|
||||
nritems = btrfs_header_nritems(path->nodes[0]);
|
||||
path->slots[0]++;
|
||||
if (path->slots[0] >= nritems) {
|
||||
ret = btrfs_next_leaf(root, path);
|
||||
if (ret)
|
||||
goto out;
|
||||
} else {
|
||||
path->slots[0]++;
|
||||
}
|
||||
|
||||
btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* current->executable is only used by the procfs. This allows a dispatch
|
||||
* table to check for several different types of binary formats. We keep
|
||||
* trying until we recognize the file or we run out of supported binary
|
||||
* formats.
|
||||
* formats.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
@@ -1091,6 +1091,13 @@ int flush_old_exec(struct linux_binprm * bprm)
|
||||
flush_thread();
|
||||
current->personality &= ~bprm->per_clear;
|
||||
|
||||
/*
|
||||
* We have to apply CLOEXEC before we change whether the process is
|
||||
* dumpable (in setup_new_exec) to avoid a race with a process in userspace
|
||||
* trying to access the should-be-closed file descriptors of a process
|
||||
* undergoing exec(2).
|
||||
*/
|
||||
do_close_on_exec(current->files);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
@@ -1141,7 +1148,6 @@ void setup_new_exec(struct linux_binprm * bprm)
|
||||
current->self_exec_id++;
|
||||
|
||||
flush_signal_handlers(current, 0);
|
||||
do_close_on_exec(current->files);
|
||||
}
|
||||
EXPORT_SYMBOL(setup_new_exec);
|
||||
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
|
||||
name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
if (error)
|
||||
if (error < 0)
|
||||
return error;
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
ext3_mark_inode_dirty(handle, inode);
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
|
||||
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
if (error < 0)
|
||||
if (error)
|
||||
return error;
|
||||
inode->i_ctime = ext4_current_time(inode);
|
||||
ext4_mark_inode_dirty(handle, inode);
|
||||
|
||||
+5
-4
@@ -339,8 +339,10 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
|
||||
|
||||
len -= EXT4_MIN_INLINE_DATA_SIZE;
|
||||
value = kzalloc(len, GFP_NOFS);
|
||||
if (!value)
|
||||
if (!value) {
|
||||
error = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
|
||||
value, len);
|
||||
@@ -1145,10 +1147,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
|
||||
set_buffer_uptodate(dir_block);
|
||||
err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
set_buffer_verified(dir_block);
|
||||
out:
|
||||
return err;
|
||||
return ext4_mark_inode_dirty(handle, inode);
|
||||
}
|
||||
|
||||
static int ext4_convert_inline_data_nolock(handle_t *handle,
|
||||
|
||||
+20
-9
@@ -760,6 +760,20 @@ has_zeroout:
|
||||
int ret = check_block_validity(inode, map);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Inodes with freshly allocated blocks where contents will be
|
||||
* visible after transaction commit must be on transaction's
|
||||
* ordered data list.
|
||||
*/
|
||||
if (map->m_flags & EXT4_MAP_NEW &&
|
||||
!(map->m_flags & EXT4_MAP_UNWRITTEN) &&
|
||||
!IS_NOQUOTA(inode) &&
|
||||
ext4_should_order_data(inode)) {
|
||||
ret = ext4_jbd2_file_inode(handle, inode);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@@ -1145,15 +1159,6 @@ static int ext4_write_end(struct file *file,
|
||||
int i_size_changed = 0;
|
||||
|
||||
trace_ext4_write_end(inode, pos, len, copied);
|
||||
if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) {
|
||||
ret = ext4_jbd2_file_inode(handle, inode);
|
||||
if (ret) {
|
||||
unlock_page(page);
|
||||
page_cache_release(page);
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
if (ext4_has_inline_data(inode)) {
|
||||
ret = ext4_write_inline_data_end(inode, pos, len,
|
||||
copied, page);
|
||||
@@ -4215,6 +4220,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
|
||||
struct inode *inode;
|
||||
journal_t *journal = EXT4_SB(sb)->s_journal;
|
||||
long ret;
|
||||
loff_t size;
|
||||
int block;
|
||||
uid_t i_uid;
|
||||
gid_t i_gid;
|
||||
@@ -4307,6 +4313,11 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
|
||||
ei->i_file_acl |=
|
||||
((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
|
||||
inode->i_size = ext4_isize(raw_inode);
|
||||
if ((size = i_size_read(inode)) < 0) {
|
||||
EXT4_ERROR_INODE(inode, "bad i_size value: %lld", size);
|
||||
ret = -EIO;
|
||||
goto bad_inode;
|
||||
}
|
||||
ei->i_disksize = inode->i_size;
|
||||
#ifdef CONFIG_QUOTA
|
||||
ei->i_reserved_quota = 0;
|
||||
|
||||
+2
-2
@@ -668,7 +668,7 @@ static void ext4_mb_mark_free_simple(struct super_block *sb,
|
||||
ext4_grpblk_t min;
|
||||
ext4_grpblk_t max;
|
||||
ext4_grpblk_t chunk;
|
||||
unsigned short border;
|
||||
unsigned int border;
|
||||
|
||||
BUG_ON(len > EXT4_CLUSTERS_PER_GROUP(sb));
|
||||
|
||||
@@ -2222,7 +2222,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
|
||||
struct ext4_group_info *grinfo;
|
||||
struct sg {
|
||||
struct ext4_group_info info;
|
||||
ext4_grpblk_t counters[16];
|
||||
ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
|
||||
} sg;
|
||||
|
||||
group--;
|
||||
|
||||
@@ -294,6 +294,7 @@ static int stat_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
static const struct file_operations stat_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = stat_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
|
||||
+4
-2
@@ -443,6 +443,7 @@ static void fuse_file_put(struct fuse_file *ff, bool sync)
|
||||
struct fuse_req *req = ff->reserved_req;
|
||||
|
||||
if (sync) {
|
||||
req->force = 1;
|
||||
req->background = 0;
|
||||
fuse_request_send(ff->fc, req);
|
||||
path_put(&req->misc.release.path);
|
||||
@@ -2713,6 +2714,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||
loff_t i_size;
|
||||
size_t count = iov_length(iov, nr_segs);
|
||||
struct fuse_io_priv *io;
|
||||
bool is_sync = is_sync_kiocb(iocb);
|
||||
|
||||
pos = offset;
|
||||
inode = file->f_mapping->host;
|
||||
@@ -2748,7 +2750,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||
* to wait on real async I/O requests, so we must submit this request
|
||||
* synchronously.
|
||||
*/
|
||||
if (!is_sync_kiocb(iocb) && (offset + count > i_size) && rw == WRITE)
|
||||
if (!is_sync && (offset + count > i_size) && rw == WRITE)
|
||||
io->async = false;
|
||||
|
||||
if (rw == WRITE)
|
||||
@@ -2760,7 +2762,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||
fuse_aio_complete(io, ret < 0 ? ret : 0, -1);
|
||||
|
||||
/* we have a non-extending, async request, so return */
|
||||
if (!is_sync_kiocb(iocb))
|
||||
if (!is_sync)
|
||||
return -EIOCBQUEUED;
|
||||
|
||||
ret = wait_on_sync_kiocb(iocb);
|
||||
|
||||
+8
-2
@@ -82,14 +82,20 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value,
|
||||
return PTR_ERR(acl);
|
||||
}
|
||||
if (acl) {
|
||||
struct posix_acl *old_acl;
|
||||
|
||||
error = posix_acl_valid(acl);
|
||||
if (error)
|
||||
goto failed;
|
||||
switch (type) {
|
||||
case ACL_TYPE_ACCESS:
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
if (error)
|
||||
old_acl = acl;
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode,
|
||||
&acl);
|
||||
if (error < 0)
|
||||
goto failed;
|
||||
if (!acl)
|
||||
posix_acl_release(old_acl);
|
||||
inode->i_ctime = CURRENT_TIME;
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
||||
+5
-3
@@ -268,11 +268,13 @@ static int gfs2_xattr_system_set(struct dentry *dentry, const char *name,
|
||||
|
||||
if (type == ACL_TYPE_ACCESS) {
|
||||
umode_t mode = inode->i_mode;
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
|
||||
if (error)
|
||||
error = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (error < 0)
|
||||
goto out_release;
|
||||
if (!acl)
|
||||
posix_acl_release(old_acl);
|
||||
|
||||
error = gfs2_set_mode(inode, mode);
|
||||
if (error)
|
||||
|
||||
+3
-2
@@ -693,9 +693,10 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
|
||||
return rc;
|
||||
}
|
||||
if (acl) {
|
||||
struct posix_acl *old_acl = acl;
|
||||
rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
|
||||
posix_acl_release(acl);
|
||||
if (rc) {
|
||||
posix_acl_release(old_acl);
|
||||
if (rc < 0) {
|
||||
printk(KERN_ERR
|
||||
"posix_acl_update_mode returned %d\n",
|
||||
rc);
|
||||
|
||||
@@ -821,7 +821,8 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
|
||||
nfs4_wait_ds_connect(ds);
|
||||
}
|
||||
out_test_devid:
|
||||
if (filelayout_test_devid_unavailable(devid))
|
||||
if (ret->ds_clp == NULL ||
|
||||
filelayout_test_devid_unavailable(devid))
|
||||
ret = NULL;
|
||||
out:
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -2435,7 +2435,7 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
|
||||
encode_compound_hdr(xdr, req, &hdr);
|
||||
encode_sequence(xdr, &args->seq_args, &hdr);
|
||||
encode_putfh(xdr, args->fh, &hdr);
|
||||
replen = hdr.replen + op_decode_hdr_maxsz + 1;
|
||||
replen = hdr.replen + op_decode_hdr_maxsz;
|
||||
encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);
|
||||
|
||||
xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
|
||||
|
||||
+2
-2
@@ -274,12 +274,12 @@ static int ocfs2_set_acl(handle_t *handle,
|
||||
case ACL_TYPE_ACCESS:
|
||||
name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
|
||||
if (acl) {
|
||||
umode_t mode = inode->i_mode;
|
||||
umode_t mode;
|
||||
ret = posix_acl_update_mode(inode, &mode, &acl);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = ocfs2_acl_set_mode(inode, di_bh,
|
||||
handle, mode);
|
||||
handle, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+43
-86
@@ -34,9 +34,8 @@
|
||||
copy_to_user((typeof(a) __user *)b, &(a), sizeof(a))
|
||||
|
||||
/*
|
||||
* This call is void because we are already reporting an error that may
|
||||
* be -EFAULT. The error will be returned from the ioctl(2) call. It's
|
||||
* just a best-effort to tell userspace that this request caused the error.
|
||||
* This is just a best-effort to tell userspace that this request
|
||||
* caused the error.
|
||||
*/
|
||||
static inline void o2info_set_request_error(struct ocfs2_info_request *kreq,
|
||||
struct ocfs2_info_request __user *req)
|
||||
@@ -145,136 +144,105 @@ bail:
|
||||
int ocfs2_info_handle_blocksize(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_blocksize oib;
|
||||
|
||||
if (o2info_from_user(oib, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
oib.ib_blocksize = inode->i_sb->s_blocksize;
|
||||
|
||||
o2info_set_request_filled(&oib.ib_req);
|
||||
|
||||
if (o2info_to_user(oib, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oib.ib_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_clustersize(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_clustersize oic;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oic, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
oic.ic_clustersize = osb->s_clustersize;
|
||||
|
||||
o2info_set_request_filled(&oic.ic_req);
|
||||
|
||||
if (o2info_to_user(oic, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oic.ic_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_maxslots(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_maxslots oim;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oim, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
oim.im_max_slots = osb->max_slots;
|
||||
|
||||
o2info_set_request_filled(&oim.im_req);
|
||||
|
||||
if (o2info_to_user(oim, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oim.im_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_label(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_label oil;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oil, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN);
|
||||
|
||||
o2info_set_request_filled(&oil.il_req);
|
||||
|
||||
if (o2info_to_user(oil, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oil.il_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_uuid(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_uuid oiu;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oiu, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1);
|
||||
|
||||
o2info_set_request_filled(&oiu.iu_req);
|
||||
|
||||
if (o2info_to_user(oiu, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oiu.iu_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_fs_features(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_fs_features oif;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oif, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
oif.if_compat_features = osb->s_feature_compat;
|
||||
oif.if_incompat_features = osb->s_feature_incompat;
|
||||
@@ -283,39 +251,28 @@ int ocfs2_info_handle_fs_features(struct inode *inode,
|
||||
o2info_set_request_filled(&oif.if_req);
|
||||
|
||||
if (o2info_to_user(oif, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oif.if_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_handle_journal_size(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_journal_size oij;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
|
||||
if (o2info_from_user(oij, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
oij.ij_journal_size = osb->journal->j_inode->i_size;
|
||||
|
||||
o2info_set_request_filled(&oij.ij_req);
|
||||
|
||||
if (o2info_to_user(oij, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oij.ij_req, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb,
|
||||
@@ -371,7 +328,7 @@ int ocfs2_info_handle_freeinode(struct inode *inode,
|
||||
u32 i;
|
||||
u64 blkno = -1;
|
||||
char namebuf[40];
|
||||
int status = -EFAULT, type = INODE_ALLOC_SYSTEM_INODE;
|
||||
int status, type = INODE_ALLOC_SYSTEM_INODE;
|
||||
struct ocfs2_info_freeinode *oifi = NULL;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
struct inode *inode_alloc = NULL;
|
||||
@@ -383,8 +340,10 @@ int ocfs2_info_handle_freeinode(struct inode *inode,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (o2info_from_user(*oifi, req))
|
||||
goto bail;
|
||||
if (o2info_from_user(*oifi, req)) {
|
||||
status = -EFAULT;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
oifi->ifi_slotnum = osb->max_slots;
|
||||
|
||||
@@ -421,14 +380,16 @@ int ocfs2_info_handle_freeinode(struct inode *inode,
|
||||
|
||||
o2info_set_request_filled(&oifi->ifi_req);
|
||||
|
||||
if (o2info_to_user(*oifi, req))
|
||||
goto bail;
|
||||
if (o2info_to_user(*oifi, req)) {
|
||||
status = -EFAULT;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oifi->ifi_req, req);
|
||||
|
||||
out_free:
|
||||
kfree(oifi);
|
||||
out_err:
|
||||
return status;
|
||||
@@ -655,7 +616,7 @@ int ocfs2_info_handle_freefrag(struct inode *inode,
|
||||
{
|
||||
u64 blkno = -1;
|
||||
char namebuf[40];
|
||||
int status = -EFAULT, type = GLOBAL_BITMAP_SYSTEM_INODE;
|
||||
int status, type = GLOBAL_BITMAP_SYSTEM_INODE;
|
||||
|
||||
struct ocfs2_info_freefrag *oiff;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
@@ -668,8 +629,10 @@ int ocfs2_info_handle_freefrag(struct inode *inode,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (o2info_from_user(*oiff, req))
|
||||
goto bail;
|
||||
if (o2info_from_user(*oiff, req)) {
|
||||
status = -EFAULT;
|
||||
goto out_free;
|
||||
}
|
||||
/*
|
||||
* chunksize from userspace should be power of 2.
|
||||
*/
|
||||
@@ -708,14 +671,14 @@ int ocfs2_info_handle_freefrag(struct inode *inode,
|
||||
|
||||
if (o2info_to_user(*oiff, req)) {
|
||||
status = -EFAULT;
|
||||
goto bail;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oiff->iff_req, req);
|
||||
|
||||
out_free:
|
||||
kfree(oiff);
|
||||
out_err:
|
||||
return status;
|
||||
@@ -724,23 +687,17 @@ out_err:
|
||||
int ocfs2_info_handle_unknown(struct inode *inode,
|
||||
struct ocfs2_info_request __user *req)
|
||||
{
|
||||
int status = -EFAULT;
|
||||
struct ocfs2_info_request oir;
|
||||
|
||||
if (o2info_from_user(oir, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
o2info_clear_request_filled(&oir);
|
||||
|
||||
if (o2info_to_user(oir, req))
|
||||
goto bail;
|
||||
return -EFAULT;
|
||||
|
||||
status = 0;
|
||||
bail:
|
||||
if (status)
|
||||
o2info_set_request_error(&oir, req);
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -438,6 +438,37 @@ posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p)
|
||||
}
|
||||
EXPORT_SYMBOL(posix_acl_create);
|
||||
|
||||
/**
|
||||
* posix_acl_update_mode - update mode in set_acl
|
||||
*
|
||||
* Update the file mode when setting an ACL: compute the new file permission
|
||||
* bits based on the ACL. In addition, if the ACL is equivalent to the new
|
||||
* file mode, set *acl to NULL to indicate that no ACL should be set.
|
||||
*
|
||||
* As with chmod, clear the setgit bit if the caller is not in the owning group
|
||||
* or capable of CAP_FSETID (see inode_change_ok).
|
||||
*
|
||||
* Called from set_acl inode operations.
|
||||
*/
|
||||
int posix_acl_update_mode(struct inode *inode, umode_t *mode_p,
|
||||
struct posix_acl **acl)
|
||||
{
|
||||
umode_t mode = inode->i_mode;
|
||||
int error;
|
||||
|
||||
error = posix_acl_equiv_mode(*acl, &mode);
|
||||
if (error < 0)
|
||||
return error;
|
||||
if (error == 0)
|
||||
*acl = NULL;
|
||||
if (!in_group_p(inode->i_gid) &&
|
||||
!capable_wrt_inode_uidgid(inode, CAP_FSETID))
|
||||
mode &= ~S_ISGID;
|
||||
*mode_p = mode;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(posix_acl_update_mode);
|
||||
|
||||
int
|
||||
posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
|
||||
{
|
||||
|
||||
+23
-2
@@ -34,6 +34,11 @@
|
||||
#include <linux/slab.h>
|
||||
#include "ubifs.h"
|
||||
|
||||
static int try_read_node(const struct ubifs_info *c, void *buf, int type,
|
||||
int len, int lnum, int offs);
|
||||
static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
|
||||
struct ubifs_zbranch *zbr, void *node);
|
||||
|
||||
/*
|
||||
* Returned codes of 'matches_name()' and 'fallible_matches_name()' functions.
|
||||
* @NAME_LESS: name corresponding to the first argument is less than second
|
||||
@@ -419,7 +424,19 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = ubifs_tnc_read_node(c, zbr, node);
|
||||
if (c->replaying) {
|
||||
err = fallible_read_node(c, &zbr->key, zbr, node);
|
||||
/*
|
||||
* When the node was not found, return -ENOENT, 0 otherwise.
|
||||
* Negative return codes stay as-is.
|
||||
*/
|
||||
if (err == 0)
|
||||
err = -ENOENT;
|
||||
else if (err == 1)
|
||||
err = 0;
|
||||
} else {
|
||||
err = ubifs_tnc_read_node(c, zbr, node);
|
||||
}
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2795,7 +2812,11 @@ struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c,
|
||||
if (nm->name) {
|
||||
if (err) {
|
||||
/* Handle collisions */
|
||||
err = resolve_collision(c, key, &znode, &n, nm);
|
||||
if (c->replaying)
|
||||
err = fallible_resolve_collision(c, key, &znode, &n,
|
||||
nm, 0);
|
||||
else
|
||||
err = resolve_collision(c, key, &znode, &n, nm);
|
||||
dbg_tnc("rc returned %d, znode %p, n %d",
|
||||
err, znode, n);
|
||||
if (unlikely(err < 0))
|
||||
|
||||
+5
-1
@@ -388,11 +388,15 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,
|
||||
goto out_release;
|
||||
|
||||
if (type == ACL_TYPE_ACCESS) {
|
||||
umode_t mode = inode->i_mode;
|
||||
umode_t mode;
|
||||
struct posix_acl *old_acl = acl;
|
||||
|
||||
error = posix_acl_update_mode(inode, &mode, &acl);
|
||||
|
||||
if (error)
|
||||
goto out_release;
|
||||
if (!acl)
|
||||
posix_acl_release(old_acl);
|
||||
|
||||
error = xfs_set_mode(inode, mode);
|
||||
if (error)
|
||||
|
||||
Reference in New Issue
Block a user