Skip to content

Commit

Permalink
Merge branch 'akpm' (fixes from Andrew Morton)
Browse files Browse the repository at this point in the history
Merge misc fixes from Andrew Morton.

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (22 commits)
  pidns: fix free_pid() to handle the first fork failure
  ipc,msg: prevent race with rmid in msgsnd,msgrcv
  ipc/sem.c: update sem_otime for all operations
  mm/hwpoison: fix the lack of one reference count against poisoned page
  mm/hwpoison: fix false report on 2nd attempt at page recovery
  mm/hwpoison: fix test for a transparent huge page
  mm/hwpoison: fix traversal of hugetlbfs pages to avoid printk flood
  block: change config option name for cmdline partition parsing
  mm/mlock.c: prevent walking off the end of a pagetable in no-pmd configuration
  mm: avoid reinserting isolated balloon pages into LRU lists
  arch/parisc/mm/fault.c: fix uninitialized variable usage
  include/asm-generic/vtime.h: avoid zero-length file
  nilfs2: fix issue with race condition of competition between segments for dirty blocks
  Documentation/kernel-parameters.txt: replace kernelcore with Movable
  mm/bounce.c: fix a regression where MS_SNAP_STABLE (stable pages snapshotting) was ignored
  kernel/kmod.c: check for NULL in call_usermodehelper_exec()
  ipc/sem.c: synchronize the proc interface
  ipc/sem.c: optimize sem_lock()
  ipc/sem.c: fix race in sem_lock()
  mm/compaction.c: periodically schedule when freeing pages
  ...
  • Loading branch information
Linus Torvalds committed Sep 30, 2013
2 parents df532d5 + 314a8ad commit 522d6d3
Show file tree
Hide file tree
Showing 26 changed files with 258 additions and 102 deletions.
2 changes: 2 additions & 0 deletions Documentation/block/00-INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ capability.txt
- Generic Block Device Capability (/sys/block/<device>/capability)
cfq-iosched.txt
- CFQ IO scheduler tunables
cmdline-partition.txt
- how to specify block device partitions on kernel command line
data-integrity.txt
- Block data integrity
deadline-iosched.txt
Expand Down
8 changes: 4 additions & 4 deletions Documentation/block/cmdline-partition.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Embedded device command line partition
Embedded device command line partition parsing
=====================================================================

Read block device partition table from command line.
The partition used for fixed block device (eMMC) embedded device.
It is no MBR, save storage space. Bootloader can be easily accessed
Support for reading the block device partition table from the command line.
It is typically used for fixed block (eMMC) embedded devices.
It has no MBR, so saves storage space. Bootloader can be easily accessed
by absolute address of data on the block device.
Users can easily change the partition.

Expand Down
6 changes: 5 additions & 1 deletion Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
Format: <io>,<irq>,<mode>
See header of drivers/net/hamradio/baycom_ser_hdx.c.

blkdevparts= Manual partition parsing of block device(s) for
embedded devices based on command line input.
See Documentation/block/cmdline-partition.txt

boot_delay= Milliseconds to delay each printk during boot.
Values larger than 10 seconds (10000) are changed to
no delay (0).
Expand Down Expand Up @@ -1357,7 +1361,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
pages. In the event, a node is too small to have both
kernelcore and Movable pages, kernelcore pages will
take priority and other nodes will have a larger number
of kernelcore pages. The Movable zone is used for the
of Movable pages. The Movable zone is used for the
allocation of pages that may be reclaimed or moved
by the page migration subsystem. This means that
HugeTLB pages may not be allocated from this zone.
Expand Down
5 changes: 3 additions & 2 deletions arch/parisc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,

if (user_mode(regs))
flags |= FAULT_FLAG_USER;

acc_type = parisc_acctyp(code, regs->iir);

if (acc_type & VM_WRITE)
flags |= FAULT_FLAG_WRITE;
retry:
Expand All @@ -196,8 +199,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,

good_area:

acc_type = parisc_acctyp(code,regs->iir);

if ((vma->vm_flags & acc_type) != acc_type)
goto bad_area;

Expand Down
9 changes: 7 additions & 2 deletions block/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ config BLK_DEV_THROTTLING

See Documentation/cgroups/blkio-controller.txt for more information.

config CMDLINE_PARSER
config BLK_CMDLINE_PARSER
bool "Block device command line partition parser"
default n
---help---
Parsing command line, get the partitions information.
Enabling this option allows you to specify the partition layout from
the kernel boot args. This is typically of use for embedded devices
which don't otherwise have any standardized method for listing the
partitions on a block device.

See Documentation/block/cmdline-partition.txt for more information.

menu "Partition Types"

Expand Down
2 changes: 1 addition & 1 deletion block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o

obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o
obj-$(CONFIG_BLK_DEV_INTEGRITY) += blk-integrity.o
obj-$(CONFIG_CMDLINE_PARSER) += cmdline-parser.o
obj-$(CONFIG_BLK_CMDLINE_PARSER) += cmdline-parser.o
4 changes: 2 additions & 2 deletions block/partitions/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ config SYSV68_PARTITION

config CMDLINE_PARTITION
bool "Command line partition support" if PARTITION_ADVANCED
select CMDLINE_PARSER
select BLK_CMDLINE_PARSER
help
Say Y here if you would read the partitions table from bootargs.
Say Y here if you want to read the partition table from bootargs.
The format for the command line is just like mtdparts.
8 changes: 4 additions & 4 deletions block/partitions/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright (C) 2013 HUAWEI
* Author: Cai Zhiyong <caizhiyong@huawei.com>
*
* Read block device partition table from command line.
* The partition used for fixed block device (eMMC) embedded device.
* It is no MBR, save storage space. Bootloader can be easily accessed
* Read block device partition table from the command line.
* Typically used for fixed block (eMMC) embedded devices.
* It has no MBR, so saves storage space. Bootloader can be easily accessed
* by absolute address of data on the block device.
* Users can easily change the partition.
*
* The format for the command line is just like mtdparts.
*
* Verbose config please reference "Documentation/block/cmdline-partition.txt"
* For further information, see "Documentation/block/cmdline-partition.txt"
*
*/

Expand Down
30 changes: 18 additions & 12 deletions fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
* long file_ofs
* followed by COUNT filenames in ASCII: "FILE1" NUL "FILE2" NUL...
*/
static void fill_files_note(struct memelfnote *note)
static int fill_files_note(struct memelfnote *note)
{
struct vm_area_struct *vma;
unsigned count, size, names_ofs, remaining, n;
Expand All @@ -1428,11 +1428,11 @@ static void fill_files_note(struct memelfnote *note)
names_ofs = (2 + 3 * count) * sizeof(data[0]);
alloc:
if (size >= MAX_FILE_NOTE_SIZE) /* paranoia check */
goto err;
return -EINVAL;
size = round_up(size, PAGE_SIZE);
data = vmalloc(size);
if (!data)
goto err;
return -ENOMEM;

start_end_ofs = data + 2;
name_base = name_curpos = ((char *)data) + names_ofs;
Expand Down Expand Up @@ -1485,7 +1485,7 @@ static void fill_files_note(struct memelfnote *note)

size = name_curpos - (char *)data;
fill_note(note, "CORE", NT_FILE, size, data);
err: ;
return 0;
}

#ifdef CORE_DUMP_USE_REGSET
Expand Down Expand Up @@ -1686,8 +1686,8 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
fill_auxv_note(&info->auxv, current->mm);
info->size += notesize(&info->auxv);

fill_files_note(&info->files);
info->size += notesize(&info->files);
if (fill_files_note(&info->files) == 0)
info->size += notesize(&info->files);

return 1;
}
Expand Down Expand Up @@ -1719,7 +1719,8 @@ static int write_note_info(struct elf_note_info *info,
return 0;
if (first && !writenote(&info->auxv, file, foffset))
return 0;
if (first && !writenote(&info->files, file, foffset))
if (first && info->files.data &&
!writenote(&info->files, file, foffset))
return 0;

for (i = 1; i < info->thread_notes; ++i)
Expand Down Expand Up @@ -1806,6 +1807,7 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)

struct elf_note_info {
struct memelfnote *notes;
struct memelfnote *notes_files;
struct elf_prstatus *prstatus; /* NT_PRSTATUS */
struct elf_prpsinfo *psinfo; /* NT_PRPSINFO */
struct list_head thread_list;
Expand Down Expand Up @@ -1896,9 +1898,12 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,

fill_siginfo_note(info->notes + 2, &info->csigdata, siginfo);
fill_auxv_note(info->notes + 3, current->mm);
fill_files_note(info->notes + 4);
info->numnote = 4;

info->numnote = 5;
if (fill_files_note(info->notes + info->numnote) == 0) {
info->notes_files = info->notes + info->numnote;
info->numnote++;
}

/* Try to dump the FPU. */
info->prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, regs,
Expand Down Expand Up @@ -1960,8 +1965,9 @@ static void free_note_info(struct elf_note_info *info)
kfree(list_entry(tmp, struct elf_thread_status, list));
}

/* Free data allocated by fill_files_note(): */
vfree(info->notes[4].data);
/* Free data possibly allocated by fill_files_note(): */
if (info->notes_files)
vfree(info->notes_files->data);

kfree(info->prstatus);
kfree(info->psinfo);
Expand Down Expand Up @@ -2044,7 +2050,7 @@ static int elf_core_dump(struct coredump_params *cprm)
struct vm_area_struct *vma, *gate_vma;
struct elfhdr *elf = NULL;
loff_t offset = 0, dataoff, foffset;
struct elf_note_info info;
struct elf_note_info info = { };
struct elf_phdr *phdr4note = NULL;
struct elf_shdr *shdr4extnum = NULL;
Elf_Half e_phnum;
Expand Down
2 changes: 2 additions & 0 deletions fs/nilfs2/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void nilfs_forget_buffer(struct buffer_head *bh)
clear_buffer_nilfs_volatile(bh);
clear_buffer_nilfs_checked(bh);
clear_buffer_nilfs_redirected(bh);
clear_buffer_async_write(bh);
clear_buffer_dirty(bh);
if (nilfs_page_buffers_clean(page))
__nilfs_clear_page_dirty(page);
Expand Down Expand Up @@ -429,6 +430,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
"discard block %llu, size %zu",
(u64)bh->b_blocknr, bh->b_size);
}
clear_buffer_async_write(bh);
clear_buffer_dirty(bh);
clear_buffer_nilfs_volatile(bh);
clear_buffer_nilfs_checked(bh);
Expand Down
11 changes: 9 additions & 2 deletions fs/nilfs2/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,

bh = head = page_buffers(page);
do {
if (!buffer_dirty(bh))
if (!buffer_dirty(bh) || buffer_async_write(bh))
continue;
get_bh(bh);
list_add_tail(&bh->b_assoc_buffers, listp);
Expand Down Expand Up @@ -699,7 +699,8 @@ static void nilfs_lookup_dirty_node_buffers(struct inode *inode,
for (i = 0; i < pagevec_count(&pvec); i++) {
bh = head = page_buffers(pvec.pages[i]);
do {
if (buffer_dirty(bh)) {
if (buffer_dirty(bh) &&
!buffer_async_write(bh)) {
get_bh(bh);
list_add_tail(&bh->b_assoc_buffers,
listp);
Expand Down Expand Up @@ -1579,6 +1580,7 @@ static void nilfs_segctor_prepare_write(struct nilfs_sc_info *sci)

list_for_each_entry(bh, &segbuf->sb_segsum_buffers,
b_assoc_buffers) {
set_buffer_async_write(bh);
if (bh->b_page != bd_page) {
if (bd_page) {
lock_page(bd_page);
Expand All @@ -1592,6 +1594,7 @@ static void nilfs_segctor_prepare_write(struct nilfs_sc_info *sci)

list_for_each_entry(bh, &segbuf->sb_payload_buffers,
b_assoc_buffers) {
set_buffer_async_write(bh);
if (bh == segbuf->sb_super_root) {
if (bh->b_page != bd_page) {
lock_page(bd_page);
Expand Down Expand Up @@ -1677,6 +1680,7 @@ static void nilfs_abort_logs(struct list_head *logs, int err)
list_for_each_entry(segbuf, logs, sb_list) {
list_for_each_entry(bh, &segbuf->sb_segsum_buffers,
b_assoc_buffers) {
clear_buffer_async_write(bh);
if (bh->b_page != bd_page) {
if (bd_page)
end_page_writeback(bd_page);
Expand All @@ -1686,6 +1690,7 @@ static void nilfs_abort_logs(struct list_head *logs, int err)

list_for_each_entry(bh, &segbuf->sb_payload_buffers,
b_assoc_buffers) {
clear_buffer_async_write(bh);
if (bh == segbuf->sb_super_root) {
if (bh->b_page != bd_page) {
end_page_writeback(bd_page);
Expand Down Expand Up @@ -1755,6 +1760,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
b_assoc_buffers) {
set_buffer_uptodate(bh);
clear_buffer_dirty(bh);
clear_buffer_async_write(bh);
if (bh->b_page != bd_page) {
if (bd_page)
end_page_writeback(bd_page);
Expand All @@ -1776,6 +1782,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
b_assoc_buffers) {
set_buffer_uptodate(bh);
clear_buffer_dirty(bh);
clear_buffer_async_write(bh);
clear_buffer_delay(bh);
clear_buffer_nilfs_volatile(bh);
clear_buffer_nilfs_redirected(bh);
Expand Down
1 change: 1 addition & 0 deletions include/asm-generic/vtime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* no content, but patch(1) dislikes empty files */
25 changes: 25 additions & 0 deletions include/linux/balloon_compaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,26 @@ static inline bool balloon_page_movable(struct page *page)
return false;
}

/*
* isolated_balloon_page - identify an isolated balloon page on private
* compaction/migration page lists.
*
* After a compaction thread isolates a balloon page for migration, it raises
* the page refcount to prevent concurrent compaction threads from re-isolating
* the same page. For that reason putback_movable_pages(), or other routines
* that need to identify isolated balloon pages on private pagelists, cannot
* rely on balloon_page_movable() to accomplish the task.
*/
static inline bool isolated_balloon_page(struct page *page)
{
/* Already isolated balloon pages, by default, have a raised refcount */
if (page_flags_cleared(page) && !page_mapped(page) &&
page_count(page) >= 2)
return __is_movable_balloon_page(page);

return false;
}

/*
* balloon_page_insert - insert a page into the balloon's page list and make
* the page->mapping assignment accordingly.
Expand Down Expand Up @@ -243,6 +263,11 @@ static inline bool balloon_page_movable(struct page *page)
return false;
}

static inline bool isolated_balloon_page(struct page *page)
{
return false;
}

static inline bool balloon_page_isolate(struct page *page)
{
return false;
Expand Down
13 changes: 13 additions & 0 deletions ipc/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,12 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
if (ipcperms(ns, &msq->q_perm, S_IWUGO))
goto out_unlock0;

/* raced with RMID? */
if (msq->q_perm.deleted) {
err = -EIDRM;
goto out_unlock0;
}

err = security_msg_queue_msgsnd(msq, msg, msgflg);
if (err)
goto out_unlock0;
Expand Down Expand Up @@ -901,6 +907,13 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl
goto out_unlock1;

ipc_lock_object(&msq->q_perm);

/* raced with RMID? */
if (msq->q_perm.deleted) {
msg = ERR_PTR(-EIDRM);
goto out_unlock0;
}

msg = find_msg(msq, &msgtyp, mode);
if (!IS_ERR(msg)) {
/*
Expand Down
Loading

0 comments on commit 522d6d3

Please sign in to comment.