Merge tag 'v3.10.65' into update
This is the 3.10.65 stable release
This commit is contained in:
@@ -1843,6 +1843,14 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_delayed_node *delayed_node;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* we don't do delayed inode updates during log recovery because it
|
||||
* leads to enospc problems. This means we also can't do
|
||||
* delayed inode refs
|
||||
*/
|
||||
if (BTRFS_I(inode)->root->fs_info->log_root_recovering)
|
||||
return -EAGAIN;
|
||||
|
||||
delayed_node = btrfs_get_or_create_delayed_node(inode);
|
||||
if (IS_ERR(delayed_node))
|
||||
return PTR_ERR(delayed_node);
|
||||
|
||||
+22
-7
@@ -470,12 +470,28 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
|
||||
* write_inode()
|
||||
*/
|
||||
spin_lock(&inode->i_lock);
|
||||
/* Clear I_DIRTY_PAGES if we've written out all dirty pages */
|
||||
if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
|
||||
inode->i_state &= ~I_DIRTY_PAGES;
|
||||
|
||||
dirty = inode->i_state & I_DIRTY;
|
||||
inode->i_state &= ~(I_DIRTY_SYNC | I_DIRTY_DATASYNC);
|
||||
inode->i_state &= ~I_DIRTY;
|
||||
|
||||
/*
|
||||
* Paired with smp_mb() in __mark_inode_dirty(). This allows
|
||||
* __mark_inode_dirty() to test i_state without grabbing i_lock -
|
||||
* either they see the I_DIRTY bits cleared or we see the dirtied
|
||||
* inode.
|
||||
*
|
||||
* I_DIRTY_PAGES is always cleared together above even if @mapping
|
||||
* still has dirty pages. The flag is reinstated after smp_mb() if
|
||||
* necessary. This guarantees that either __mark_inode_dirty()
|
||||
* sees clear I_DIRTY_PAGES or we see PAGECACHE_TAG_DIRTY.
|
||||
*/
|
||||
smp_mb();
|
||||
|
||||
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
|
||||
inode->i_state |= I_DIRTY_PAGES;
|
||||
|
||||
spin_unlock(&inode->i_lock);
|
||||
|
||||
/* Don't write the inode if only I_DIRTY_PAGES was set */
|
||||
if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
|
||||
int err = write_inode(inode, wbc);
|
||||
@@ -1146,12 +1162,11 @@ void __mark_inode_dirty(struct inode *inode, int flags)
|
||||
}
|
||||
|
||||
/*
|
||||
* make sure that changes are seen by all cpus before we test i_state
|
||||
* -- mikulas
|
||||
* Paired with smp_mb() in __writeback_single_inode() for the
|
||||
* following lockless i_state test. See there for details.
|
||||
*/
|
||||
smp_mb();
|
||||
|
||||
/* avoid the locking if we can */
|
||||
if ((inode->i_state & flags) == flags)
|
||||
return;
|
||||
|
||||
|
||||
+7
-8
@@ -1200,15 +1200,14 @@ static int copy_cred(struct svc_cred *target, struct svc_cred *source)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long long
|
||||
static int
|
||||
compare_blob(const struct xdr_netobj *o1, const struct xdr_netobj *o2)
|
||||
{
|
||||
long long res;
|
||||
|
||||
res = o1->len - o2->len;
|
||||
if (res)
|
||||
return res;
|
||||
return (long long)memcmp(o1->data, o2->data, o1->len);
|
||||
if (o1->len < o2->len)
|
||||
return -1;
|
||||
if (o1->len > o2->len)
|
||||
return 1;
|
||||
return memcmp(o1->data, o2->data, o1->len);
|
||||
}
|
||||
|
||||
static int same_name(const char *n1, const char *n2)
|
||||
@@ -1365,7 +1364,7 @@ add_clp_to_name_tree(struct nfs4_client *new_clp, struct rb_root *root)
|
||||
static struct nfs4_client *
|
||||
find_clp_in_name_tree(struct xdr_netobj *name, struct rb_root *root)
|
||||
{
|
||||
long long cmp;
|
||||
int cmp;
|
||||
struct rb_node *node = root->rb_node;
|
||||
struct nfs4_client *clp;
|
||||
|
||||
|
||||
@@ -1743,6 +1743,9 @@ static __be32 nfsd4_encode_components_esc(char sep, char *components,
|
||||
}
|
||||
else
|
||||
end++;
|
||||
if (found_esc)
|
||||
end = next;
|
||||
|
||||
str = end;
|
||||
}
|
||||
*pp = p;
|
||||
|
||||
+24
-8
@@ -49,6 +49,8 @@ struct nilfs_iget_args {
|
||||
int for_gc;
|
||||
};
|
||||
|
||||
static int nilfs_iget_test(struct inode *inode, void *opaque);
|
||||
|
||||
void nilfs_inode_add_blocks(struct inode *inode, int n)
|
||||
{
|
||||
struct nilfs_root *root = NILFS_I(inode)->i_root;
|
||||
@@ -347,6 +349,17 @@ const struct address_space_operations nilfs_aops = {
|
||||
.is_partially_uptodate = block_is_partially_uptodate,
|
||||
};
|
||||
|
||||
static int nilfs_insert_inode_locked(struct inode *inode,
|
||||
struct nilfs_root *root,
|
||||
unsigned long ino)
|
||||
{
|
||||
struct nilfs_iget_args args = {
|
||||
.ino = ino, .root = root, .cno = 0, .for_gc = 0
|
||||
};
|
||||
|
||||
return insert_inode_locked4(inode, ino, nilfs_iget_test, &args);
|
||||
}
|
||||
|
||||
struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
|
||||
{
|
||||
struct super_block *sb = dir->i_sb;
|
||||
@@ -382,7 +395,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
|
||||
if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
|
||||
err = nilfs_bmap_read(ii->i_bmap, NULL);
|
||||
if (err < 0)
|
||||
goto failed_bmap;
|
||||
goto failed_after_creation;
|
||||
|
||||
set_bit(NILFS_I_BMAP, &ii->i_state);
|
||||
/* No lock is needed; iget() ensures it. */
|
||||
@@ -398,21 +411,24 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
|
||||
spin_lock(&nilfs->ns_next_gen_lock);
|
||||
inode->i_generation = nilfs->ns_next_generation++;
|
||||
spin_unlock(&nilfs->ns_next_gen_lock);
|
||||
insert_inode_hash(inode);
|
||||
if (nilfs_insert_inode_locked(inode, root, ino) < 0) {
|
||||
err = -EIO;
|
||||
goto failed_after_creation;
|
||||
}
|
||||
|
||||
err = nilfs_init_acl(inode, dir);
|
||||
if (unlikely(err))
|
||||
goto failed_acl; /* never occur. When supporting
|
||||
goto failed_after_creation; /* never occur. When supporting
|
||||
nilfs_init_acl(), proper cancellation of
|
||||
above jobs should be considered */
|
||||
|
||||
return inode;
|
||||
|
||||
failed_acl:
|
||||
failed_bmap:
|
||||
failed_after_creation:
|
||||
clear_nlink(inode);
|
||||
unlock_new_inode(inode);
|
||||
iput(inode); /* raw_inode will be deleted through
|
||||
generic_delete_inode() */
|
||||
nilfs_evict_inode() */
|
||||
goto failed;
|
||||
|
||||
failed_ifile_create_inode:
|
||||
@@ -460,8 +476,8 @@ int nilfs_read_inode_common(struct inode *inode,
|
||||
inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
|
||||
inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec);
|
||||
inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
|
||||
if (inode->i_nlink == 0 && inode->i_mode == 0)
|
||||
return -EINVAL; /* this inode is deleted */
|
||||
if (inode->i_nlink == 0)
|
||||
return -ESTALE; /* this inode is deleted */
|
||||
|
||||
inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
|
||||
ii->i_flags = le32_to_cpu(raw_inode->i_flags);
|
||||
|
||||
+12
-3
@@ -51,9 +51,11 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode)
|
||||
int err = nilfs_add_link(dentry, inode);
|
||||
if (!err) {
|
||||
d_instantiate(dentry, inode);
|
||||
unlock_new_inode(inode);
|
||||
return 0;
|
||||
}
|
||||
inode_dec_link_count(inode);
|
||||
unlock_new_inode(inode);
|
||||
iput(inode);
|
||||
return err;
|
||||
}
|
||||
@@ -182,6 +184,7 @@ out:
|
||||
out_fail:
|
||||
drop_nlink(inode);
|
||||
nilfs_mark_inode_dirty(inode);
|
||||
unlock_new_inode(inode);
|
||||
iput(inode);
|
||||
goto out;
|
||||
}
|
||||
@@ -201,11 +204,15 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
inode_inc_link_count(inode);
|
||||
ihold(inode);
|
||||
|
||||
err = nilfs_add_nondir(dentry, inode);
|
||||
if (!err)
|
||||
err = nilfs_add_link(dentry, inode);
|
||||
if (!err) {
|
||||
d_instantiate(dentry, inode);
|
||||
err = nilfs_transaction_commit(dir->i_sb);
|
||||
else
|
||||
} else {
|
||||
inode_dec_link_count(inode);
|
||||
iput(inode);
|
||||
nilfs_transaction_abort(dir->i_sb);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -243,6 +250,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
|
||||
nilfs_mark_inode_dirty(inode);
|
||||
d_instantiate(dentry, inode);
|
||||
unlock_new_inode(inode);
|
||||
out:
|
||||
if (!err)
|
||||
err = nilfs_transaction_commit(dir->i_sb);
|
||||
@@ -255,6 +263,7 @@ out_fail:
|
||||
drop_nlink(inode);
|
||||
drop_nlink(inode);
|
||||
nilfs_mark_inode_dirty(inode);
|
||||
unlock_new_inode(inode);
|
||||
iput(inode);
|
||||
out_dir:
|
||||
drop_nlink(dir);
|
||||
|
||||
+14
-2
@@ -917,7 +917,7 @@ void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
|
||||
}
|
||||
}
|
||||
|
||||
static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
|
||||
static void ocfs2_unlock_pages(struct ocfs2_write_ctxt *wc)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -938,7 +938,11 @@ static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
|
||||
page_cache_release(wc->w_target_page);
|
||||
}
|
||||
ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages);
|
||||
}
|
||||
|
||||
static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
|
||||
{
|
||||
ocfs2_unlock_pages(wc);
|
||||
brelse(wc->w_di_bh);
|
||||
kfree(wc);
|
||||
}
|
||||
@@ -2060,11 +2064,19 @@ out_write_size:
|
||||
di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
|
||||
ocfs2_journal_dirty(handle, wc->w_di_bh);
|
||||
|
||||
/* unlock pages before dealloc since it needs acquiring j_trans_barrier
|
||||
* lock, or it will cause a deadlock since journal commit threads holds
|
||||
* this lock and will ask for the page lock when flushing the data.
|
||||
* put it here to preserve the unlock order.
|
||||
*/
|
||||
ocfs2_unlock_pages(wc);
|
||||
|
||||
ocfs2_commit_trans(osb, handle);
|
||||
|
||||
ocfs2_run_deallocs(osb, &wc->w_dealloc);
|
||||
|
||||
ocfs2_free_write_ctxt(wc);
|
||||
brelse(wc->w_di_bh);
|
||||
kfree(wc);
|
||||
|
||||
return copied;
|
||||
}
|
||||
|
||||
+11
-2
@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400);
|
||||
MODULE_PARM_DESC(mem_size,
|
||||
"size of reserved RAM used to store oops/panic logs");
|
||||
|
||||
static unsigned int mem_type;
|
||||
module_param(mem_type, uint, 0600);
|
||||
MODULE_PARM_DESC(mem_type,
|
||||
"set to 1 to try to use unbuffered memory (default 0)");
|
||||
|
||||
static int dump_oops = 1;
|
||||
module_param(dump_oops, int, 0600);
|
||||
MODULE_PARM_DESC(dump_oops,
|
||||
@@ -79,6 +84,7 @@ struct ramoops_context {
|
||||
struct persistent_ram_zone *fprz;
|
||||
phys_addr_t phys_addr;
|
||||
unsigned long size;
|
||||
unsigned int memtype;
|
||||
size_t record_size;
|
||||
size_t console_size;
|
||||
size_t ftrace_size;
|
||||
@@ -331,7 +337,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
|
||||
size_t sz = cxt->record_size;
|
||||
|
||||
cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
|
||||
&cxt->ecc_info);
|
||||
&cxt->ecc_info,
|
||||
cxt->memtype);
|
||||
if (IS_ERR(cxt->przs[i])) {
|
||||
err = PTR_ERR(cxt->przs[i]);
|
||||
dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
|
||||
@@ -361,7 +368,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info);
|
||||
*prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, cxt->memtype);
|
||||
if (IS_ERR(*prz)) {
|
||||
int err = PTR_ERR(*prz);
|
||||
|
||||
@@ -417,6 +424,7 @@ static int ramoops_probe(struct platform_device *pdev)
|
||||
cxt->dump_read_cnt = 0;
|
||||
cxt->size = pdata->mem_size;
|
||||
cxt->phys_addr = pdata->mem_address;
|
||||
cxt->memtype = pdata->mem_type;
|
||||
cxt->record_size = pdata->record_size;
|
||||
cxt->console_size = pdata->console_size;
|
||||
cxt->ftrace_size = pdata->ftrace_size;
|
||||
@@ -547,6 +555,7 @@ static void ramoops_register_dummy(void)
|
||||
|
||||
dummy_data->mem_size = mem_size;
|
||||
dummy_data->mem_address = mem_address;
|
||||
dummy_data->mem_type = 0;
|
||||
dummy_data->record_size = record_size;
|
||||
dummy_data->console_size = ramoops_console_size;
|
||||
dummy_data->ftrace_size = ramoops_ftrace_size;
|
||||
|
||||
+22
-9
@@ -333,7 +333,8 @@ void persistent_ram_zap(struct persistent_ram_zone *prz)
|
||||
persistent_ram_update_header_ecc(prz);
|
||||
}
|
||||
|
||||
static void *persistent_ram_vmap(phys_addr_t start, size_t size)
|
||||
static void *persistent_ram_vmap(phys_addr_t start, size_t size,
|
||||
unsigned int memtype)
|
||||
{
|
||||
struct page **pages;
|
||||
phys_addr_t page_start;
|
||||
@@ -345,7 +346,10 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)
|
||||
page_start = start - offset_in_page(start);
|
||||
page_count = DIV_ROUND_UP(size + offset_in_page(start), PAGE_SIZE);
|
||||
|
||||
prot = pgprot_noncached(PAGE_KERNEL);
|
||||
if (memtype)
|
||||
prot = pgprot_noncached(PAGE_KERNEL);
|
||||
else
|
||||
prot = pgprot_writecombine(PAGE_KERNEL);
|
||||
|
||||
pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL);
|
||||
if (!pages) {
|
||||
@@ -364,27 +368,35 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
static void *persistent_ram_iomap(phys_addr_t start, size_t size)
|
||||
static void *persistent_ram_iomap(phys_addr_t start, size_t size,
|
||||
unsigned int memtype)
|
||||
{
|
||||
void *va;
|
||||
|
||||
if (!request_mem_region(start, size, "persistent_ram")) {
|
||||
pr_err("request mem region (0x%llx@0x%llx) failed\n",
|
||||
(unsigned long long)size, (unsigned long long)start);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ioremap(start, size);
|
||||
if (memtype)
|
||||
va = ioremap(start, size);
|
||||
else
|
||||
va = ioremap_wc(start, size);
|
||||
|
||||
return va;
|
||||
}
|
||||
|
||||
static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
|
||||
struct persistent_ram_zone *prz)
|
||||
struct persistent_ram_zone *prz, int memtype)
|
||||
{
|
||||
prz->paddr = start;
|
||||
prz->size = size;
|
||||
|
||||
if (pfn_valid(start >> PAGE_SHIFT))
|
||||
prz->vaddr = persistent_ram_vmap(start, size);
|
||||
prz->vaddr = persistent_ram_vmap(start, size, memtype);
|
||||
else
|
||||
prz->vaddr = persistent_ram_iomap(start, size);
|
||||
prz->vaddr = persistent_ram_iomap(start, size, memtype);
|
||||
|
||||
if (!prz->vaddr) {
|
||||
pr_err("%s: Failed to map 0x%llx pages at 0x%llx\n", __func__,
|
||||
@@ -452,7 +464,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
|
||||
}
|
||||
|
||||
struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
|
||||
u32 sig, struct persistent_ram_ecc_info *ecc_info)
|
||||
u32 sig, struct persistent_ram_ecc_info *ecc_info,
|
||||
unsigned int memtype)
|
||||
{
|
||||
struct persistent_ram_zone *prz;
|
||||
int ret = -ENOMEM;
|
||||
@@ -463,7 +476,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = persistent_ram_buffer_map(start, size, prz);
|
||||
ret = persistent_ram_buffer_map(start, size, prz, memtype);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user