···10241024backlight brightness control interface if it detects that the standard10251025ACPI interface is available in the ThinkPad.1026102610271027+If you want to use the thinkpad-acpi backlight brightness control10281028+instead of the generic ACPI video backlight brightness control for some10291029+reason, you should use the acpi_backlight=vendor kernel parameter.10301030+10271031The brightness_enable module parameter can be used to control whether10281032the LCD brightness control feature will be enabled when available.10291033brightness_enable=0 forces it to be disabled. brightness_enable=1
+2-29
Documentation/powerpc/booting-without-of.txt
···4949 f) MDIO on GPIOs5050 g) SPI busses51515252- VII - Marvell Discovery mv64[345]6x System Controller chips5353- 1) The /system-controller node5454- 2) Child nodes of /system-controller5555- a) Marvell Discovery MDIO bus5656- b) Marvell Discovery ethernet controller5757- c) Marvell Discovery PHY nodes5858- d) Marvell Discovery SDMA nodes5959- e) Marvell Discovery BRG nodes6060- f) Marvell Discovery CUNIT nodes6161- g) Marvell Discovery MPSCROUTING nodes6262- h) Marvell Discovery MPSCINTR nodes6363- i) Marvell Discovery MPSC nodes6464- j) Marvell Discovery Watch Dog Timer nodes6565- k) Marvell Discovery I2C nodes6666- l) Marvell Discovery PIC (Programmable Interrupt Controller) nodes6767- m) Marvell Discovery MPP (Multipurpose Pins) multiplexing nodes6868- n) Marvell Discovery GPP (General Purpose Pins) nodes6969- o) Marvell Discovery PCI host bridge node7070- p) Marvell Discovery CPU Error nodes7171- q) Marvell Discovery SRAM Controller nodes7272- r) Marvell Discovery PCI Error Handler nodes7373- s) Marvell Discovery Memory Controller nodes7474-7575- VIII - Specifying interrupt information for devices5252+ VII - Specifying interrupt information for devices7653 1) interrupts property7754 2) interrupt-parent property7855 3) OpenPIC Interrupt Controllers7956 4) ISA Interrupt Controllers80578181- IX - Specifying GPIO information for devices8282- 1) gpios property8383- 2) gpio-controller nodes8484-8585- X - Specifying device power management information (sleep property)5858+ VIII - Specifying device power management information (sleep property)86598760 Appendix A - Sample SOC node for MPC85408861
···2121# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:2222KBUILD_CFLAGS +=$(call cc-option,-marm,)23232424+# Never generate .eh_frame2525+KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)2626+2427# Do not use arch/arm/defconfig - it's always outdated.2528# Select a platform tht is kept up-to-date2629KBUILD_DEFCONFIG := versatile_defconfig
+13-4
arch/arm/include/asm/ptrace.h
···158158 */159159static inline int valid_user_regs(struct pt_regs *regs)160160{161161- if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {162162- regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);163163- return 1;161161+ unsigned long mode = regs->ARM_cpsr & MODE_MASK;162162+163163+ /*164164+ * Always clear the F (FIQ) and A (delayed abort) bits165165+ */166166+ regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);167167+168168+ if ((regs->ARM_cpsr & PSR_I_BIT) == 0) {169169+ if (mode == USR_MODE)170170+ return 1;171171+ if (elf_hwcap & HWCAP_26BIT && mode == USR26_MODE)172172+ return 1;164173 }165174166175 /*167176 * Force CPSR to something logical...168177 */169169- regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT;178178+ regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | PSR_T_BIT | MODE32_BIT;170179 if (!(elf_hwcap & HWCAP_26BIT))171180 regs->ARM_cpsr |= USR_MODE;172181
+1
arch/arm/include/asm/unistd.h
···392392#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)393393#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)394394#define __NR_recvmmsg (__NR_SYSCALL_BASE+365)395395+#define __NR_accept4 (__NR_SYSCALL_BASE+366)395396396397/*397398 * The following SWIs are ARM private.
···7979 return;80808181 /* Initialize to zero */8282- for (regno = 0; regno < GDB_MAX_REGS; regno++)8282+ for (regno = 0; regno < DBG_MAX_REG_NUM; regno++)8383 gdb_regs[regno] = 0;84848585 /* Otherwise, we have only some registers from switch_to() */
+9-5
arch/arm/kernel/sys_arm.c
···6262/* sys_execve() executes a new program.6363 * This is called indirectly via a small wrapper6464 */6565-asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv,6666- char __user * __user *envp, struct pt_regs *regs)6565+asmlinkage int sys_execve(const char __user *filenamei,6666+ const char __user *const __user *argv,6767+ const char __user *const __user *envp, struct pt_regs *regs)6768{6869 int error;6970 char * filename;···7978 return error;8079}81808282-int kernel_execve(const char *filename, char *const argv[], char *const envp[])8181+int kernel_execve(const char *filename,8282+ const char *const argv[],8383+ const char *const envp[])8384{8485 struct pt_regs regs;8586 int ret;86878788 memset(®s, 0, sizeof(struct pt_regs));8888- ret = do_execve(filename, (char __user * __user *)argv,8989- (char __user * __user *)envp, ®s);8989+ ret = do_execve(filename,9090+ (const char __user *const __user *)argv,9191+ (const char __user *const __user *)envp, ®s);9092 if (ret < 0)9193 goto out;9294
···209209/*210210 * sys_execve() executes a new program.211211 */212212-asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)212212+asmlinkage int sys_execve(const char __user *name,213213+ const char __user *const __user *argv,214214+ const char __user *const __user *envp)213215{214216 int error;215217 char *filename;
+3-1
arch/cris/arch-v10/kernel/process.c
···204204/*205205 * sys_execve() executes a new program.206206 */207207-asmlinkage int sys_execve(const char *fname, char **argv, char **envp,207207+asmlinkage int sys_execve(const char *fname,208208+ const char *const *argv,209209+ const char *const *envp,208210 long r13, long mof, long srp, 209211 struct pt_regs *regs)210212{
+4-2
arch/cris/arch-v32/kernel/process.c
···218218219219/* sys_execve() executes a new program. */220220asmlinkage int221221-sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp,222222- struct pt_regs *regs)221221+sys_execve(const char *fname,222222+ const char *const *argv,223223+ const char *const *envp, long r13, long mof, long srp,224224+ struct pt_regs *regs)223225{224226 int error;225227 char *filename;
+3-2
arch/frv/kernel/process.c
···250250/*251251 * sys_execve() executes a new program.252252 */253253-asmlinkage int sys_execve(const char __user *name, char __user * __user *argv,254254- char __user * __user *envp)253253+asmlinkage int sys_execve(const char __user *name,254254+ const char __user *const __user *argv,255255+ const char __user *const __user *envp)255256{256257 int error;257258 char * filename;
+4-1
arch/h8300/kernel/process.c
···212212/*213213 * sys_execve() executes a new program.214214 */215215-asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...)215215+asmlinkage int sys_execve(const char *name,216216+ const char *const *argv,217217+ const char *const *envp,218218+ int dummy, ...)216219{217220 int error;218221 char * filename;
+3-1
arch/h8300/kernel/sys_h8300.c
···5151 * Do a system call from kernel instead of calling sys_execve so we5252 * end up with proper pt_regs.5353 */5454-int kernel_execve(const char *filename, char *const argv[], char *const envp[])5454+int kernel_execve(const char *filename,5555+ const char *const argv[],5656+ const char *const envp[])5557{5658 register long res __asm__("er0");5759 register char *const *_c __asm__("er3") = envp;
-2
arch/ia64/include/asm/unistd.h
···356356 int fd, long pgoff);357357struct pt_regs;358358struct sigaction;359359-long sys_execve(const char __user *filename, char __user * __user *argv,360360- char __user * __user *envp, struct pt_regs *regs);361359asmlinkage long sys_ia64_pipe(void);362360asmlinkage long sys_rt_sigaction(int sig,363361 const struct sigaction __user *act,
···289289 * sys_execve() executes a new program.290290 */291291asmlinkage int sys_execve(const char __user *ufilename,292292- char __user * __user *uargv,293293- char __user * __user *uenvp,292292+ const char __user *const __user *uargv,293293+ const char __user *const __user *uenvp,294294 unsigned long r3, unsigned long r4, unsigned long r5,295295 unsigned long r6, struct pt_regs regs)296296{
+3-1
arch/m32r/kernel/sys_m32r.c
···9393 * Do a system call from kernel instead of calling sys_execve so we9494 * end up with proper pt_regs.9595 */9696-int kernel_execve(const char *filename, char *const argv[], char *const envp[])9696+int kernel_execve(const char *filename,9797+ const char *const argv[],9898+ const char *const envp[])9799{98100 register long __scno __asm__ ("r7") = __NR_execve;99101 register long __arg3 __asm__ ("r2") = (long)(envp);
+11-2
arch/m68k/include/asm/ide.h
···11/*22- * linux/include/asm-m68k/ide.h33- *42 * Copyright (C) 1994-1996 Linus Torvalds & authors53 */64···3234#include <asm/io.h>3335#include <asm/irq.h>34363737+#ifdef CONFIG_MMU3838+3539/*3640 * Get rid of defs from io.h - ide has its private and conflicting versions3741 * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we···5252#define writew(val, port) out_be16(port, val)5353#define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)5454#define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)5555+5656+#else5757+5858+#define __ide_mm_insw(port, addr, n) io_insw((unsigned int)port, addr, n)5959+#define __ide_mm_insl(port, addr, n) io_insl((unsigned int)port, addr, n)6060+#define __ide_mm_outsw(port, addr, n) io_outsw((unsigned int)port, addr, n)6161+#define __ide_mm_outsl(port, addr, n) io_outsl((unsigned int)port, addr, n)6262+6363+#endif /* CONFIG_MMU */55645665#endif /* __KERNEL__ */5766#endif /* _M68K_IDE_H */
+3-1
arch/m68k/kernel/process.c
···315315/*316316 * sys_execve() executes a new program.317317 */318318-asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)318318+asmlinkage int sys_execve(const char __user *name,319319+ const char __user *const __user *argv,320320+ const char __user *const __user *envp)319321{320322 int error;321323 char * filename;
+3-1
arch/m68k/kernel/sys_m68k.c
···459459 * Do a system call from kernel instead of calling sys_execve so we460460 * end up with proper pt_regs.461461 */462462-int kernel_execve(const char *filename, char *const argv[], char *const envp[])462462+int kernel_execve(const char *filename,463463+ const char *const argv[],464464+ const char *const envp[])463465{464466 register long __res asm ("%d0") = __NR_execve;465467 register long __a asm ("%d1") = (long)(filename);
+8-6
arch/m68knommu/kernel/process.c
···316316 fp->d0, fp->d1, fp->d2, fp->d3);317317 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",318318 fp->d4, fp->d5, fp->a0, fp->a1);319319- printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %08x\n",320320- (unsigned int) rdusp(), (unsigned int) fp);319319+ printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %p\n",320320+ (unsigned int) rdusp(), fp);321321322322 printk(KERN_EMERG "\nCODE:");323323 tp = ((unsigned char *) fp->pc) - 0x20;324324 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {325325 if ((i % 0x10) == 0)326326- printk(KERN_EMERG "%08x: ", (int) (tp + i));326326+ printk(KERN_EMERG "%p: ", tp + i);327327 printk("%08x ", (int) *sp++);328328 }329329 printk(KERN_EMERG "\n");···332332 tp = ((unsigned char *) fp) - 0x40;333333 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {334334 if ((i % 0x10) == 0)335335- printk(KERN_EMERG "%08x: ", (int) (tp + i));335335+ printk(KERN_EMERG "%p: ", tp + i);336336 printk("%08x ", (int) *sp++);337337 }338338 printk(KERN_EMERG "\n");···341341 tp = (unsigned char *) (rdusp() - 0x10);342342 for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {343343 if ((i % 0x10) == 0)344344- printk(KERN_EMERG "%08x: ", (int) (tp + i));344344+ printk(KERN_EMERG "%p: ", tp + i);345345 printk("%08x ", (int) *sp++);346346 }347347 printk(KERN_EMERG "\n");···350350/*351351 * sys_execve() executes a new program.352352 */353353-asmlinkage int sys_execve(const char *name, char **argv, char **envp)353353+asmlinkage int sys_execve(const char *name,354354+ const char *const *argv,355355+ const char *const *envp)354356{355357 int error;356358 char * filename;
+3-1
arch/m68knommu/kernel/sys_m68k.c
···4444 * Do a system call from kernel instead of calling sys_execve so we4545 * end up with proper pt_regs.4646 */4747-int kernel_execve(const char *filename, char *const argv[], char *const envp[])4747+int kernel_execve(const char *filename,4848+ const char *const argv[],4949+ const char *const envp[])4850{4951 register long __res asm ("%d0") = __NR_execve;5052 register long __a asm ("%d1") = (long)(filename);
+1-1
arch/microblaze/kernel/prom_parse.c
···7373 /* We can only get here if we hit a P2P bridge with no node,7474 * let's do standard swizzling and try again7575 */7676- lspec = of_irq_pci_swizzle(PCI_SLOT(pdev->devfn), lspec);7676+ lspec = pci_swizzle_interrupt_pin(pdev, lspec);7777 pdev = ppdev;7878 }7979
+7-3
arch/microblaze/kernel/sys_microblaze.c
···4747 return do_fork(flags, stack, regs, 0, NULL, NULL);4848}49495050-asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv,5151- char __user *__user *envp, struct pt_regs *regs)5050+asmlinkage long microblaze_execve(const char __user *filenamei,5151+ const char __user *const __user *argv,5252+ const char __user *const __user *envp,5353+ struct pt_regs *regs)5254{5355 int error;5456 char *filename;···7977 * Do a system call from kernel instead of calling sys_execve so we8078 * end up with proper pt_regs.8179 */8282-int kernel_execve(const char *filename, char *const argv[], char *const envp[])8080+int kernel_execve(const char *filename,8181+ const char *const argv[],8282+ const char *const envp[])8383{8484 register const char *__a __asm__("r5") = filename;8585 register const void *__b __asm__("r6") = argv;
+3-2
arch/microblaze/pci/pci-common.c
···2727#include <linux/irq.h>2828#include <linux/vmalloc.h>2929#include <linux/slab.h>3030+#include <linux/of.h>3131+#include <linux/of_address.h>30323133#include <asm/processor.h>3234#include <asm/io.h>3333-#include <asm/prom.h>3435#include <asm/pci-bridge.h>3536#include <asm/byteorder.h>3637···10781077 struct dev_archdata *sd = &dev->dev.archdata;1079107810801079 /* Setup OF node pointer in archdata */10811081- sd->of_node = pci_device_to_OF_node(dev);10801080+ dev->dev.of_node = pci_device_to_OF_node(dev);1082108110831082 /* Fixup NUMA node as it may not be setup yet by the generic10841083 * code and is needed by the DMA init
···7171 * Do a system call from kernel instead of calling sys_execve so we7272 * end up with proper pt_regs.7373 */7474-int kernel_execve(const char *filename, char *const argv[], char *const envp[])7474+int kernel_execve(const char *filename,7575+ const char *const argv[],7676+ const char *const envp[])7577{7678 register long __sc0 __asm__ ("r3") = __NR_execve;7779 register long __sc4 __asm__ ("r4") = (long) filename;
+3-1
arch/sh/kernel/sys_sh64.c
···3333 * Do a system call from kernel instead of calling sys_execve so we3434 * end up with proper pt_regs.3535 */3636-int kernel_execve(const char *filename, char *const argv[], char *const envp[])3636+int kernel_execve(const char *filename,3737+ const char *const argv[],3838+ const char *const envp[])3739{3840 register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve);3941 register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename;
+3-3
arch/sparc/include/asm/atomic_64.h
···2525extern void atomic64_sub(int, atomic64_t *);26262727extern int atomic_add_ret(int, atomic_t *);2828-extern int atomic64_add_ret(int, atomic64_t *);2828+extern long atomic64_add_ret(int, atomic64_t *);2929extern int atomic_sub_ret(int, atomic_t *);3030-extern int atomic64_sub_ret(int, atomic64_t *);3030+extern long atomic64_sub_ret(int, atomic64_t *);31313232#define atomic_dec_return(v) atomic_sub_ret(1, v)3333#define atomic64_dec_return(v) atomic64_sub_ret(1, v)···9191 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))9292#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))93939494-static inline int atomic64_add_unless(atomic64_t *v, long a, long u)9494+static inline long atomic64_add_unless(atomic64_t *v, long a, long u)9595{9696 long c, old;9797 c = atomic64_read(v);
···282282 * Do a system call from kernel instead of calling sys_execve so we283283 * end up with proper pt_regs.284284 */285285-int kernel_execve(const char *filename, char *const argv[], char *const envp[])285285+int kernel_execve(const char *filename,286286+ const char *const argv[],287287+ const char *const envp[])286288{287289 long __res;288290 register long __g1 __asm__ ("g1") = __NR_execve;
+3-1
arch/sparc/kernel/sys_sparc_64.c
···758758 * Do a system call from kernel instead of calling sys_execve so we759759 * end up with proper pt_regs.760760 */761761-int kernel_execve(const char *filename, char *const argv[], char *const envp[])761761+int kernel_execve(const char *filename,762762+ const char *const argv[],763763+ const char *const envp[])762764{763765 long __res;764766 register long __g1 __asm__ ("g1") = __NR_execve;
···194194 unsigned long addr;195195 int len;196196 int type;197197- struct perf_event **pev;197197+ struct perf_event * __percpu *pev;198198} breakinfo[HBP_NUM];199199200200static unsigned long early_dr7;
···2828 * Do a system call from kernel instead of calling sys_execve so we2929 * end up with proper pt_regs.3030 */3131-int kernel_execve(const char *filename, char *const argv[], char *const envp[])3131+int kernel_execve(const char *filename,3232+ const char *const argv[],3333+ const char *const envp[])3234{3335 long __res;3436 asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
···136136DEFINE_MUTEX(tty_mutex);137137EXPORT_SYMBOL(tty_mutex);138138139139+/* Spinlock to protect the tty->tty_files list */140140+DEFINE_SPINLOCK(tty_files_lock);141141+139142static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);140143static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);141144ssize_t redirected_tty_write(struct file *, const char __user *,···187184 tty_buffer_free_all(tty);188185 kfree(tty);189186}187187+188188+static inline struct tty_struct *file_tty(struct file *file)189189+{190190+ return ((struct tty_file_private *)file->private_data)->tty;191191+}192192+193193+/* Associate a new file with the tty structure */194194+void tty_add_file(struct tty_struct *tty, struct file *file)195195+{196196+ struct tty_file_private *priv;197197+198198+ /* XXX: must implement proper error handling in callers */199199+ priv = kmalloc(sizeof(*priv), GFP_KERNEL|__GFP_NOFAIL);200200+201201+ priv->tty = tty;202202+ priv->file = file;203203+ file->private_data = priv;204204+205205+ spin_lock(&tty_files_lock);206206+ list_add(&priv->list, &tty->tty_files);207207+ spin_unlock(&tty_files_lock);208208+}209209+210210+/* Delete file from its tty */211211+void tty_del_file(struct file *file)212212+{213213+ struct tty_file_private *priv = file->private_data;214214+215215+ spin_lock(&tty_files_lock);216216+ list_del(&priv->list);217217+ spin_unlock(&tty_files_lock);218218+ file->private_data = NULL;219219+ kfree(priv);220220+}221221+190222191223#define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base)192224···273235 struct list_head *p;274236 int count = 0;275237276276- file_list_lock();238238+ spin_lock(&tty_files_lock);277239 list_for_each(p, &tty->tty_files) {278240 count++;279241 }280280- file_list_unlock();242242+ spin_unlock(&tty_files_lock);281243 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&282244 tty->driver->subtype == PTY_TYPE_SLAVE &&283245 tty->link && tty->link->count)···535497 struct file *cons_filp = NULL;536498 struct file *filp, *f = NULL;537499 struct task_struct *p;500500+ struct tty_file_private *priv;538501 int closecount = 0, n;539502 unsigned long flags;540503 int refs = 0;···545506546507547508 spin_lock(&redirect_lock);548548- if (redirect && redirect->private_data == tty) {509509+ if (redirect && file_tty(redirect) == tty) {549510 f = redirect;550511 redirect = NULL;551512 }···558519 workqueue with the lock held */559520 check_tty_count(tty, "tty_hangup");560521561561- file_list_lock();522522+ spin_lock(&tty_files_lock);562523 /* This breaks for file handles being sent over AF_UNIX sockets ? */563563- list_for_each_entry(filp, &tty->tty_files, f_u.fu_list) {524524+ list_for_each_entry(priv, &tty->tty_files, list) {525525+ filp = priv->file;564526 if (filp->f_op->write == redirected_tty_write)565527 cons_filp = filp;566528 if (filp->f_op->write != tty_write)···570530 __tty_fasync(-1, filp, 0); /* can't block */571531 filp->f_op = &hung_up_tty_fops;572532 }573573- file_list_unlock();533533+ spin_unlock(&tty_files_lock);574534575535 tty_ldisc_hangup(tty);576536···929889 loff_t *ppos)930890{931891 int i;932932- struct tty_struct *tty;933933- struct inode *inode;892892+ struct inode *inode = file->f_path.dentry->d_inode;893893+ struct tty_struct *tty = file_tty(file);934894 struct tty_ldisc *ld;935895936936- tty = file->private_data;937937- inode = file->f_path.dentry->d_inode;938896 if (tty_paranoia_check(tty, inode, "tty_read"))939897 return -EIO;940898 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags)))···11031065static ssize_t tty_write(struct file *file, const char __user *buf,11041066 size_t count, loff_t *ppos)11051067{11061106- struct tty_struct *tty;11071068 struct inode *inode = file->f_path.dentry->d_inode;10691069+ struct tty_struct *tty = file_tty(file);10701070+ struct tty_ldisc *ld;11081071 ssize_t ret;11091109- struct tty_ldisc *ld;1110107211111111- tty = file->private_data;11121073 if (tty_paranoia_check(tty, inode, "tty_write"))11131074 return -EIO;11141075 if (!tty || !tty->ops->write ||···14611424 tty_driver_kref_put(driver);14621425 module_put(driver->owner);1463142614641464- file_list_lock();14271427+ spin_lock(&tty_files_lock);14651428 list_del_init(&tty->tty_files);14661466- file_list_unlock();14291429+ spin_unlock(&tty_files_lock);1467143014681431 put_pid(tty->pgrp);14691432 put_pid(tty->session);···1544150715451508int tty_release(struct inode *inode, struct file *filp)15461509{15471547- struct tty_struct *tty, *o_tty;15101510+ struct tty_struct *tty = file_tty(filp);15111511+ struct tty_struct *o_tty;15481512 int pty_master, tty_closing, o_tty_closing, do_sleep;15491513 int devpts;15501514 int idx;15511515 char buf[64];1552151615531553- tty = filp->private_data;15541517 if (tty_paranoia_check(tty, inode, "tty_release_dev"))15551518 return 0;15561519···17081671 * - do_tty_hangup no longer sees this file descriptor as17091672 * something that needs to be handled for hangups.17101673 */17111711- file_kill(filp);17121712- filp->private_data = NULL;16741674+ tty_del_file(filp);1713167517141676 /*17151677 * Perform some housekeeping before deciding whether to return.···18751839 return PTR_ERR(tty);18761840 }1877184118781878- filp->private_data = tty;18791879- file_move(filp, &tty->tty_files);18421842+ tty_add_file(tty, filp);18431843+18801844 check_tty_count(tty, "tty_open");18811845 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&18821846 tty->driver->subtype == PTY_TYPE_MASTER)···1952191619531917static unsigned int tty_poll(struct file *filp, poll_table *wait)19541918{19551955- struct tty_struct *tty;19191919+ struct tty_struct *tty = file_tty(filp);19561920 struct tty_ldisc *ld;19571921 int ret = 0;1958192219591959- tty = filp->private_data;19601923 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll"))19611924 return 0;19621925···1968193319691934static int __tty_fasync(int fd, struct file *filp, int on)19701935{19711971- struct tty_struct *tty;19361936+ struct tty_struct *tty = file_tty(filp);19721937 unsigned long flags;19731938 int retval = 0;1974193919751975- tty = filp->private_data;19761940 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync"))19771941 goto out;19781942···25252491 */25262492long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)25272493{25282528- struct tty_struct *tty, *real_tty;24942494+ struct tty_struct *tty = file_tty(file);24952495+ struct tty_struct *real_tty;25292496 void __user *p = (void __user *)arg;25302497 int retval;25312498 struct tty_ldisc *ld;25322499 struct inode *inode = file->f_dentry->d_inode;2533250025342534- tty = file->private_data;25352501 if (tty_paranoia_check(tty, inode, "tty_ioctl"))25362502 return -EINVAL;25372503···26532619 unsigned long arg)26542620{26552621 struct inode *inode = file->f_dentry->d_inode;26562656- struct tty_struct *tty = file->private_data;26222622+ struct tty_struct *tty = file_tty(file);26572623 struct tty_ldisc *ld;26582624 int retval = -ENOIOCTLCMD;26592625···27452711 if (!filp)27462712 continue;27472713 if (filp->f_op->read == tty_read &&27482748- filp->private_data == tty) {27142714+ file_tty(filp) == tty) {27492715 printk(KERN_NOTICE "SAK: killed process %d"27502716 " (%s): fd#%d opened to the tty\n",27512717 task_pid_nr(p), p->comm, i);
+7-4
drivers/char/vt.c
···194194int fg_console;195195int last_console;196196int want_console = -1;197197-int saved_fg_console;198198-int saved_last_console;199199-int saved_want_console;200200-int saved_vc_mode;197197+static int saved_fg_console;198198+static int saved_last_console;199199+static int saved_want_console;200200+static int saved_vc_mode;201201+static int saved_console_blanked;201202202203/*203204 * For each existing display, we have a pointer to console currently visible···34503449 saved_last_console = last_console;34513450 saved_want_console = want_console;34523451 saved_vc_mode = vc->vc_mode;34523452+ saved_console_blanked = console_blanked;34533453 vc->vc_mode = KD_TEXT;34543454 console_blanked = 0;34553455 if (vc->vc_sw->con_debug_enter)···34943492 fg_console = saved_fg_console;34953493 last_console = saved_last_console;34963494 want_console = saved_want_console;34953495+ console_blanked = saved_console_blanked;34973496 vc_cons[fg_console].d->vc_mode = saved_vc_mode;3498349734993498 vc = vc_cons[fg_console].d;
+1
drivers/char/xilinx_hwicap/xilinx_hwicap.c
···94949595#ifdef CONFIG_OF9696/* For open firmware. */9797+#include <linux/of_address.h>9798#include <linux/of_device.h>9899#include <linux/of_platform.h>99100#endif
···159159{160160 struct egalax_data *td = hid_get_drvdata(hid);161161162162+ /* Note, eGalax has two product lines: the first is resistive and163163+ * uses a standard parallel multitouch protocol (product ID ==164164+ * 48xx). The second is capacitive and uses an unusual "serial"165165+ * protocol with a different message for each multitouch finger166166+ * (product ID == 72xx). We do not yet generate a correct event167167+ * sequence for the capacitive/serial protocol.168168+ */162169 if (hid->claimed & HID_CLAIMED_INPUT) {163170 struct input_dev *input = field->hidinput->input;164171···253246static const struct hid_device_id egalax_devices[] = {254247 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV,255248 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },249249+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV,250250+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },256251 { }257252};258253MODULE_DEVICE_TABLE(hid, egalax_devices);
···266266{267267 struct hiddev_list *list;268268 struct usb_interface *intf;269269+ struct hid_device *hid;269270 struct hiddev *hiddev;270271 int res;271272272273 intf = usb_find_interface(&hiddev_driver, iminor(inode));273274 if (!intf)274275 return -ENODEV;275275- hiddev = usb_get_intfdata(intf);276276+ hid = usb_get_intfdata(intf);277277+ hiddev = hid->hiddev;276278277279 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL)))278280 return -ENOMEM;···589587 struct hiddev_list *list = file->private_data;590588 struct hiddev *hiddev = list->hiddev;591589 struct hid_device *hid = hiddev->hid;592592- struct usb_device *dev = hid_to_usb_dev(hid);590590+ struct usb_device *dev;593591 struct hiddev_collection_info cinfo;594592 struct hiddev_report_info rinfo;595593 struct hiddev_field_info finfo;···603601 /* Called without BKL by compat methods so no BKL taken */604602605603 /* FIXME: Who or what stop this racing with a disconnect ?? */606606- if (!hiddev->exist)604604+ if (!hiddev->exist || !hid)607605 return -EIO;606606+607607+ dev = hid_to_usb_dev(hid);608608609609 switch (cmd) {610610···892888 hid->hiddev = hiddev;893889 hiddev->hid = hid;894890 hiddev->exist = 1;895895- usb_set_intfdata(usbhid->intf, usbhid);896891 retval = usb_register_dev(usbhid->intf, &hiddev_class);897892 if (retval) {898893 err_hid("Not able to get a minor for this device.");
+18-26
drivers/md/md.c
···21362136 * with the rest of the array)21372137 */21382138 mdk_rdev_t *rdev;21392139-21402140- /* First make sure individual recovery_offsets are correct */21412141- list_for_each_entry(rdev, &mddev->disks, same_set) {21422142- if (rdev->raid_disk >= 0 &&21432143- mddev->delta_disks >= 0 &&21442144- !test_bit(In_sync, &rdev->flags) &&21452145- mddev->curr_resync_completed > rdev->recovery_offset)21462146- rdev->recovery_offset = mddev->curr_resync_completed;21472147-21482148- } 21492139 list_for_each_entry(rdev, &mddev->disks, same_set) {21502140 if (rdev->sb_events == mddev->events ||21512141 (nospares &&···21572167 int sync_req;21582168 int nospares = 0;2159216921602160- mddev->utime = get_seconds();21612161- if (mddev->external)21622162- return;21632170repeat:21712171+ /* First make sure individual recovery_offsets are correct */21722172+ list_for_each_entry(rdev, &mddev->disks, same_set) {21732173+ if (rdev->raid_disk >= 0 &&21742174+ mddev->delta_disks >= 0 &&21752175+ !test_bit(In_sync, &rdev->flags) &&21762176+ mddev->curr_resync_completed > rdev->recovery_offset)21772177+ rdev->recovery_offset = mddev->curr_resync_completed;21782178+21792179+ } 21802180+ if (mddev->external || !mddev->persistent) {21812181+ clear_bit(MD_CHANGE_DEVS, &mddev->flags);21822182+ clear_bit(MD_CHANGE_CLEAN, &mddev->flags);21832183+ wake_up(&mddev->sb_wait);21842184+ return;21852185+ }21862186+21642187 spin_lock_irq(&mddev->write_lock);21882188+21892189+ mddev->utime = get_seconds();2165219021662191 set_bit(MD_CHANGE_PENDING, &mddev->flags);21672192 if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags))···22252220 */22262221 MD_BUG();22272222 mddev->events --;22282228- }22292229-22302230- /*22312231- * do not write anything to disk if using22322232- * nonpersistent superblocks22332233- */22342234- if (!mddev->persistent) {22352235- if (!mddev->external)22362236- clear_bit(MD_CHANGE_PENDING, &mddev->flags);22372237-22382238- spin_unlock_irq(&mddev->write_lock);22392239- wake_up(&mddev->sb_wait);22402240- return;22412223 }22422224 sync_sbs(mddev, nospares);22432225 spin_unlock_irq(&mddev->write_lock);
+12-9
drivers/md/raid1.c
···787787 struct bio_list bl;788788 struct page **behind_pages = NULL;789789 const int rw = bio_data_dir(bio);790790- const bool do_sync = (bio->bi_rw & REQ_SYNC);791791- bool do_barriers;790790+ const unsigned long do_sync = (bio->bi_rw & REQ_SYNC);791791+ unsigned long do_barriers;792792 mdk_rdev_t *blocked_rdev;793793794794 /*···11201120{11211121 int i;11221122 conf_t *conf = mddev->private;11231123+ int count = 0;11241124+ unsigned long flags;1123112511241126 /*11251127 * Find all failed disks within the RAID1 configuration ···11331131 if (rdev11341132 && !test_bit(Faulty, &rdev->flags)11351133 && !test_and_set_bit(In_sync, &rdev->flags)) {11361136- unsigned long flags;11371137- spin_lock_irqsave(&conf->device_lock, flags);11381138- mddev->degraded--;11391139- spin_unlock_irqrestore(&conf->device_lock, flags);11341134+ count++;11351135+ sysfs_notify_dirent(rdev->sysfs_state);11401136 }11411137 }11381138+ spin_lock_irqsave(&conf->device_lock, flags);11391139+ mddev->degraded -= count;11401140+ spin_unlock_irqrestore(&conf->device_lock, flags);1142114111431142 print_conf(conf);11441144- return 0;11431143+ return count;11451144}1146114511471146···16431640 * We already have a nr_pending reference on these rdevs.16441641 */16451642 int i;16461646- const bool do_sync = (r1_bio->master_bio->bi_rw & REQ_SYNC);16431643+ const unsigned long do_sync = (r1_bio->master_bio->bi_rw & REQ_SYNC);16471644 clear_bit(R1BIO_BarrierRetry, &r1_bio->state);16481645 clear_bit(R1BIO_Barrier, &r1_bio->state);16491646 for (i=0; i < conf->raid_disks; i++)···16991696 (unsigned long long)r1_bio->sector);17001697 raid_end_bio_io(r1_bio);17011698 } else {17021702- const bool do_sync = r1_bio->master_bio->bi_rw & REQ_SYNC;16991699+ const unsigned long do_sync = r1_bio->master_bio->bi_rw & REQ_SYNC;17031700 r1_bio->bios[r1_bio->read_disk] =17041701 mddev->ro ? IO_BLOCKED : NULL;17051702 r1_bio->read_disk = disk;
+10-7
drivers/md/raid10.c
···799799 int i;800800 int chunk_sects = conf->chunk_mask + 1;801801 const int rw = bio_data_dir(bio);802802- const bool do_sync = (bio->bi_rw & REQ_SYNC);802802+ const unsigned long do_sync = (bio->bi_rw & REQ_SYNC);803803 struct bio_list bl;804804 unsigned long flags;805805 mdk_rdev_t *blocked_rdev;···11161116 int i;11171117 conf_t *conf = mddev->private;11181118 mirror_info_t *tmp;11191119+ int count = 0;11201120+ unsigned long flags;1119112111201122 /*11211123 * Find all non-in_sync disks within the RAID10 configuration···11281126 if (tmp->rdev11291127 && !test_bit(Faulty, &tmp->rdev->flags)11301128 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {11311131- unsigned long flags;11321132- spin_lock_irqsave(&conf->device_lock, flags);11331133- mddev->degraded--;11341134- spin_unlock_irqrestore(&conf->device_lock, flags);11291129+ count++;11301130+ sysfs_notify_dirent(tmp->rdev->sysfs_state);11351131 }11361132 }11331133+ spin_lock_irqsave(&conf->device_lock, flags);11341134+ mddev->degraded -= count;11351135+ spin_unlock_irqrestore(&conf->device_lock, flags);1137113611381137 print_conf(conf);11391139- return 0;11381138+ return count;11401139}1141114011421141···17371734 raid_end_bio_io(r10_bio);17381735 bio_put(bio);17391736 } else {17401740- const bool do_sync = (r10_bio->master_bio->bi_rw & REQ_SYNC);17371737+ const unsigned long do_sync = (r10_bio->master_bio->bi_rw & REQ_SYNC);17411738 bio_put(bio);17421739 rdev = conf->mirrors[mirror].rdev;17431740 if (printk_ratelimit())
+8-5
drivers/md/raid5.c
···53305330 int i;53315331 raid5_conf_t *conf = mddev->private;53325332 struct disk_info *tmp;53335333+ int count = 0;53345334+ unsigned long flags;5333533553345336 for (i = 0; i < conf->raid_disks; i++) {53355337 tmp = conf->disks + i;···53395337 && tmp->rdev->recovery_offset == MaxSector53405338 && !test_bit(Faulty, &tmp->rdev->flags)53415339 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {53425342- unsigned long flags;53435343- spin_lock_irqsave(&conf->device_lock, flags);53445344- mddev->degraded--;53455345- spin_unlock_irqrestore(&conf->device_lock, flags);53405340+ count++;53415341+ sysfs_notify_dirent(tmp->rdev->sysfs_state);53465342 }53475343 }53445344+ spin_lock_irqsave(&conf->device_lock, flags);53455345+ mddev->degraded -= count;53465346+ spin_unlock_irqrestore(&conf->device_lock, flags);53485347 print_raid5_conf(conf);53495349- return 0;53485348+ return count;53505349}5351535053525351static int raid5_remove_disk(mddev_t *mddev, int number)
+2
drivers/mmc/core/host.c
···8686 init_waitqueue_head(&host->wq);8787 INIT_DELAYED_WORK(&host->detect, mmc_rescan);8888 INIT_DELAYED_WORK_DEFERRABLE(&host->disable, mmc_host_deeper_disable);8989+#ifdef CONFIG_PM8990 host->pm_notify.notifier_call = mmc_pm_notify;9191+#endif90929193 /*9294 * By default, hosts do not support SGIO or large requests.
···4848#include <linux/netdevice.h>4949#include <linux/cache.h>5050#include <linux/pci.h>5151+#include <linux/pci-aspm.h>5152#include <linux/ethtool.h>5253#include <linux/uaccess.h>5354#include <linux/slab.h>···476475 struct ieee80211_hw *hw;477476 int ret;478477 u8 csz;478478+479479+ /*480480+ * L0s needs to be disabled on all ath5k cards.481481+ *482482+ * For distributions shipping with CONFIG_PCIEASPM (this will be enabled483483+ * by default in the future in 2.6.36) this will also mean both L1 and484484+ * L0s will be disabled when a pre 1.1 PCIe device is detected. We do485485+ * know L1 works correctly even for all ath5k pre 1.1 PCIe devices486486+ * though but cannot currently undue the effect of a blacklist, for487487+ * details you can read pcie_aspm_sanity_check() and see how it adjusts488488+ * the device link capability.489489+ *490490+ * It may be possible in the future to implement some PCI API to allow491491+ * drivers to override blacklists for pre 1.1 PCIe but for now it is492492+ * best to accept that both L0s and L1 will be disabled completely for493493+ * distributions shipping with CONFIG_PCIEASPM rather than having this494494+ * issue present. Motivation for adding this new API will be to help495495+ * with power consumption for some of these devices.496496+ */497497+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);479498480499 ret = pci_enable_device(pdev);481500 if (ret) {
···770770 spin_unlock(lock);771771 /*772772 * Ensure any pending I/O completes so that773773- * ll_rw_block() actually writes the current774774- * contents - it is a noop if I/O is still in775775- * flight on potentially older contents.773773+ * write_dirty_buffer() actually writes the774774+ * current contents - it is a noop if I/O is775775+ * still in flight on potentially older776776+ * contents.776777 */777777- ll_rw_block(SWRITE_SYNC_PLUG, 1, &bh);778778+ write_dirty_buffer(bh, WRITE_SYNC_PLUG);778779779780 /*780781 * Kick off IO for the previous mapping. Note···29132912 BUG_ON(buffer_unwritten(bh));2914291329152914 /*29162916- * Mask in barrier bit for a write (could be either a WRITE or a29172917- * WRITE_SYNC29182918- */29192919- if (buffer_ordered(bh) && (rw & WRITE))29202920- rw |= WRITE_BARRIER;29212921-29222922- /*29232915 * Only clear out a write error when rewriting29242916 */29252917 if (test_set_buffer_req(bh) && (rw & WRITE))···2950295629512957/**29522958 * ll_rw_block: low-level access to block devices (DEPRECATED)29532953- * @rw: whether to %READ or %WRITE or %SWRITE or maybe %READA (readahead)29592959+ * @rw: whether to %READ or %WRITE or maybe %READA (readahead)29542960 * @nr: number of &struct buffer_heads in the array29552961 * @bhs: array of pointers to &struct buffer_head29562962 *29572963 * ll_rw_block() takes an array of pointers to &struct buffer_heads, and29582964 * requests an I/O operation on them, either a %READ or a %WRITE. The third29592959- * %SWRITE is like %WRITE only we make sure that the *current* data in buffers29602960- * are sent to disk. The fourth %READA option is described in the documentation29612961- * for generic_make_request() which ll_rw_block() calls.29652965+ * %READA option is described in the documentation for generic_make_request()29662966+ * which ll_rw_block() calls.29622967 *29632968 * This function drops any buffer that it cannot get a lock on (with the29642964- * BH_Lock state bit) unless SWRITE is required, any buffer that appears to be29652965- * clean when doing a write request, and any buffer that appears to be29662966- * up-to-date when doing read request. Further it marks as clean buffers that29672967- * are processed for writing (the buffer cache won't assume that they are29682968- * actually clean until the buffer gets unlocked).29692969+ * BH_Lock state bit), any buffer that appears to be clean when doing a write29702970+ * request, and any buffer that appears to be up-to-date when doing read29712971+ * request. Further it marks as clean buffers that are processed for29722972+ * writing (the buffer cache won't assume that they are actually clean29732973+ * until the buffer gets unlocked).29692974 *29702975 * ll_rw_block sets b_end_io to simple completion handler that marks29712976 * the buffer up-to-date (if approriate), unlocks the buffer and wakes···29802987 for (i = 0; i < nr; i++) {29812988 struct buffer_head *bh = bhs[i];2982298929832983- if (rw == SWRITE || rw == SWRITE_SYNC || rw == SWRITE_SYNC_PLUG)29842984- lock_buffer(bh);29852985- else if (!trylock_buffer(bh))29902990+ if (!trylock_buffer(bh))29862991 continue;29872987-29882988- if (rw == WRITE || rw == SWRITE || rw == SWRITE_SYNC ||29892989- rw == SWRITE_SYNC_PLUG) {29922992+ if (rw == WRITE) {29902993 if (test_clear_buffer_dirty(bh)) {29912994 bh->b_end_io = end_buffer_write_sync;29922995 get_bh(bh);29932993- if (rw == SWRITE_SYNC)29942994- submit_bh(WRITE_SYNC, bh);29952995- else29962996- submit_bh(WRITE, bh);29962996+ submit_bh(WRITE, bh);29972997 continue;29982998 }29992999 } else {···30023016}30033017EXPORT_SYMBOL(ll_rw_block);3004301830193019+void write_dirty_buffer(struct buffer_head *bh, int rw)30203020+{30213021+ lock_buffer(bh);30223022+ if (!test_clear_buffer_dirty(bh)) {30233023+ unlock_buffer(bh);30243024+ return;30253025+ }30263026+ bh->b_end_io = end_buffer_write_sync;30273027+ get_bh(bh);30283028+ submit_bh(rw, bh);30293029+}30303030+EXPORT_SYMBOL(write_dirty_buffer);30313031+30053032/*30063033 * For a data-integrity writeout, we need to wait upon any in-progress I/O30073034 * and then start new I/O and then wait upon it. The caller must have a ref on30083035 * the buffer_head.30093036 */30103010-int sync_dirty_buffer(struct buffer_head *bh)30373037+int __sync_dirty_buffer(struct buffer_head *bh, int rw)30113038{30123039 int ret = 0;30133040···30293030 if (test_clear_buffer_dirty(bh)) {30303031 get_bh(bh);30313032 bh->b_end_io = end_buffer_write_sync;30323032- ret = submit_bh(WRITE_SYNC, bh);30333033+ ret = submit_bh(rw, bh);30333034 wait_on_buffer(bh);30343035 if (buffer_eopnotsupp(bh)) {30353036 clear_buffer_eopnotsupp(bh);···30413042 unlock_buffer(bh);30423043 }30433044 return ret;30453045+}30463046+EXPORT_SYMBOL(__sync_dirty_buffer);30473047+30483048+int sync_dirty_buffer(struct buffer_head *bh)30493049+{30503050+ return __sync_dirty_buffer(bh, WRITE_SYNC);30443051}30453052EXPORT_SYMBOL(sync_dirty_buffer);30463053
···13321332 * d_lookup - search for a dentry13331333 * @parent: parent dentry13341334 * @name: qstr of name we wish to find13351335+ * Returns: dentry, or NULL13351336 *13361336- * Searches the children of the parent dentry for the name in question. If13371337- * the dentry is found its reference count is incremented and the dentry13381338- * is returned. The caller must use dput to free the entry when it has13391339- * finished using it. %NULL is returned on failure.13401340- *13411341- * __d_lookup is dcache_lock free. The hash list is protected using RCU.13421342- * Memory barriers are used while updating and doing lockless traversal. 13431343- * To avoid races with d_move while rename is happening, d_lock is used.13441344- *13451345- * Overflows in memcmp(), while d_move, are avoided by keeping the length13461346- * and name pointer in one structure pointed by d_qstr.13471347- *13481348- * rcu_read_lock() and rcu_read_unlock() are used to disable preemption while13491349- * lookup is going on.13501350- *13511351- * The dentry unused LRU is not updated even if lookup finds the required dentry13521352- * in there. It is updated in places such as prune_dcache, shrink_dcache_sb,13531353- * select_parent and __dget_locked. This laziness saves lookup from dcache_lock13541354- * acquisition.13551355- *13561356- * d_lookup() is protected against the concurrent renames in some unrelated13571357- * directory using the seqlockt_t rename_lock.13371337+ * d_lookup searches the children of the parent dentry for the name in13381338+ * question. If the dentry is found its reference count is incremented and the13391339+ * dentry is returned. The caller must use dput to free the entry when it has13401340+ * finished using it. %NULL is returned if the dentry does not exist.13581341 */13591359-13601342struct dentry * d_lookup(struct dentry * parent, struct qstr * name)13611343{13621344 struct dentry * dentry = NULL;···13541372}13551373EXPORT_SYMBOL(d_lookup);1356137413751375+/*13761376+ * __d_lookup - search for a dentry (racy)13771377+ * @parent: parent dentry13781378+ * @name: qstr of name we wish to find13791379+ * Returns: dentry, or NULL13801380+ *13811381+ * __d_lookup is like d_lookup, however it may (rarely) return a13821382+ * false-negative result due to unrelated rename activity.13831383+ *13841384+ * __d_lookup is slightly faster by avoiding rename_lock read seqlock,13851385+ * however it must be used carefully, eg. with a following d_lookup in13861386+ * the case of failure.13871387+ *13881388+ * __d_lookup callers must be commented.13891389+ */13571390struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)13581391{13591392 unsigned int len = name->len;···13791382 struct hlist_node *node;13801383 struct dentry *dentry;1381138413851385+ /*13861386+ * The hash list is protected using RCU.13871387+ *13881388+ * Take d_lock when comparing a candidate dentry, to avoid races13891389+ * with d_move().13901390+ *13911391+ * It is possible that concurrent renames can mess up our list13921392+ * walk here and result in missing our dentry, resulting in the13931393+ * false-negative result. d_lookup() protects against concurrent13941394+ * renames using rename_lock seqlock.13951395+ *13961396+ * See Documentation/vfs/dcache-locking.txt for more details.13971397+ */13821398 rcu_read_lock();1383139913841400 hlist_for_each_entry_rcu(dentry, node, head, d_hash) {···1406139614071397 /*14081398 * Recheck the dentry after taking the lock - d_move may have14091409- * changed things. Don't bother checking the hash because we're14101410- * about to compare the whole name anyway.13991399+ * changed things. Don't bother checking the hash because14001400+ * we're about to compare the whole name anyway.14111401 */14121402 if (dentry->d_parent != parent)14131403 goto next;···19351925 bool slash = false;19361926 int error = 0;1937192719381938- spin_lock(&vfsmount_lock);19281928+ br_read_lock(vfsmount_lock);19391929 while (dentry != root->dentry || vfsmnt != root->mnt) {19401930 struct dentry * parent;19411931···19641954 if (!error && !slash)19651955 error = prepend(buffer, buflen, "/", 1);1966195619671967- spin_unlock(&vfsmount_lock);19571957+ br_read_unlock(vfsmount_lock);19681958 return error;1969195919701960global_root:···23022292 struct vfsmount *mnt = path1->mnt;23032293 struct dentry *dentry = path1->dentry;23042294 int res;23052305- spin_lock(&vfsmount_lock);22952295+22962296+ br_read_lock(vfsmount_lock);23062297 if (mnt != path2->mnt) {23072298 for (;;) {23082299 if (mnt->mnt_parent == mnt) {23092309- spin_unlock(&vfsmount_lock);23002300+ br_read_unlock(vfsmount_lock);23102301 return 0;23112302 }23122303 if (mnt->mnt_parent == path2->mnt)···23172306 dentry = mnt->mnt_mountpoint;23182307 }23192308 res = is_subdir(dentry, path2->dentry);23202320- spin_unlock(&vfsmount_lock);23092309+ br_read_unlock(vfsmount_lock);23212310 return res;23222311}23232312EXPORT_SYMBOL(path_is_under);
+13-12
fs/exec.c
···361361/*362362 * count() counts the number of strings in array ARGV.363363 */364364-static int count(char __user * __user * argv, int max)364364+static int count(const char __user * const __user * argv, int max)365365{366366 int i = 0;367367368368 if (argv != NULL) {369369 for (;;) {370370- char __user * p;370370+ const char __user * p;371371372372 if (get_user(p, argv))373373 return -EFAULT;···387387 * processes's memory to the new process's stack. The call to get_user_pages()388388 * ensures the destination page is created and not swapped out.389389 */390390-static int copy_strings(int argc, char __user * __user * argv,390390+static int copy_strings(int argc, const char __user *const __user *argv,391391 struct linux_binprm *bprm)392392{393393 struct page *kmapped_page = NULL;···396396 int ret;397397398398 while (argc-- > 0) {399399- char __user *str;399399+ const char __user *str;400400 int len;401401 unsigned long pos;402402···470470/*471471 * Like copy_strings, but get argv and its values from kernel memory.472472 */473473-int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm)473473+int copy_strings_kernel(int argc, const char *const *argv,474474+ struct linux_binprm *bprm)474475{475476 int r;476477 mm_segment_t oldfs = get_fs();477478 set_fs(KERNEL_DS);478478- r = copy_strings(argc, (char __user * __user *)argv, bprm);479479+ r = copy_strings(argc, (const char __user *const __user *)argv, bprm);479480 set_fs(oldfs);480481 return r;481482}···998997void setup_new_exec(struct linux_binprm * bprm)999998{1000999 int i, ch;10011001- char * name;10001000+ const char *name;10021001 char tcomm[sizeof(current->comm)];1003100210041003 arch_pick_mmap_layout(current->mm);···11181117 bprm->unsafe = tracehook_unsafe_exec(p);1119111811201119 n_fs = 1;11211121- write_lock(&p->fs->lock);11201120+ spin_lock(&p->fs->lock);11221121 rcu_read_lock();11231122 for (t = next_thread(p); t != p; t = next_thread(t)) {11241123 if (t->fs == p->fs)···11351134 res = 1;11361135 }11371136 }11381138- write_unlock(&p->fs->lock);11371137+ spin_unlock(&p->fs->lock);1139113811401139 return res;11411140}···13171316/*13181317 * sys_execve() executes a new program.13191318 */13201320-int do_execve(char * filename,13211321- char __user *__user *argv,13221322- char __user *__user *envp,13191319+int do_execve(const char * filename,13201320+ const char __user *const __user *argv,13211321+ const char __user *const __user *envp,13231322 struct pt_regs * regs)13241323{13251324 struct linux_binprm *bprm;
+3-1
fs/fat/misc.c
···250250{251251 int i, err = 0;252252253253- ll_rw_block(SWRITE, nr_bhs, bhs);253253+ for (i = 0; i < nr_bhs; i++)254254+ write_dirty_buffer(bhs[i], WRITE);255255+254256 for (i = 0; i < nr_bhs; i++) {255257 wait_on_buffer(bhs[i]);256258 if (buffer_eopnotsupp(bhs[i])) {
+95-29
fs/file_table.c
···2020#include <linux/cdev.h>2121#include <linux/fsnotify.h>2222#include <linux/sysctl.h>2323+#include <linux/lglock.h>2324#include <linux/percpu_counter.h>2525+#include <linux/percpu.h>2426#include <linux/ima.h>25272628#include <asm/atomic.h>···3432 .max_files = NR_FILE3533};36343737-/* public. Not pretty! */3838-__cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);3535+DECLARE_LGLOCK(files_lglock);3636+DEFINE_LGLOCK(files_lglock);39374038/* SLAB cache for file structures */4139static struct kmem_cache *filp_cachep __read_mostly;···251249 cdev_put(inode->i_cdev);252250 fops_put(file->f_op);253251 put_pid(file->f_owner.pid);254254- file_kill(file);252252+ file_sb_list_del(file);255253 if (file->f_mode & FMODE_WRITE)256254 drop_file_write_access(file);257255 file->f_path.dentry = NULL;···330328 return file;331329}332330333333-334331void put_filp(struct file *file)335332{336333 if (atomic_long_dec_and_test(&file->f_count)) {337334 security_file_free(file);338338- file_kill(file);335335+ file_sb_list_del(file);339336 file_free(file);340337 }341338}342339343343-void file_move(struct file *file, struct list_head *list)340340+static inline int file_list_cpu(struct file *file)344341{345345- if (!list)346346- return;347347- file_list_lock();348348- list_move(&file->f_u.fu_list, list);349349- file_list_unlock();342342+#ifdef CONFIG_SMP343343+ return file->f_sb_list_cpu;344344+#else345345+ return smp_processor_id();346346+#endif350347}351348352352-void file_kill(struct file *file)349349+/* helper for file_sb_list_add to reduce ifdefs */350350+static inline void __file_sb_list_add(struct file *file, struct super_block *sb)351351+{352352+ struct list_head *list;353353+#ifdef CONFIG_SMP354354+ int cpu;355355+ cpu = smp_processor_id();356356+ file->f_sb_list_cpu = cpu;357357+ list = per_cpu_ptr(sb->s_files, cpu);358358+#else359359+ list = &sb->s_files;360360+#endif361361+ list_add(&file->f_u.fu_list, list);362362+}363363+364364+/**365365+ * file_sb_list_add - add a file to the sb's file list366366+ * @file: file to add367367+ * @sb: sb to add it to368368+ *369369+ * Use this function to associate a file with the superblock of the inode it370370+ * refers to.371371+ */372372+void file_sb_list_add(struct file *file, struct super_block *sb)373373+{374374+ lg_local_lock(files_lglock);375375+ __file_sb_list_add(file, sb);376376+ lg_local_unlock(files_lglock);377377+}378378+379379+/**380380+ * file_sb_list_del - remove a file from the sb's file list381381+ * @file: file to remove382382+ * @sb: sb to remove it from383383+ *384384+ * Use this function to remove a file from its superblock.385385+ */386386+void file_sb_list_del(struct file *file)353387{354388 if (!list_empty(&file->f_u.fu_list)) {355355- file_list_lock();389389+ lg_local_lock_cpu(files_lglock, file_list_cpu(file));356390 list_del_init(&file->f_u.fu_list);357357- file_list_unlock();391391+ lg_local_unlock_cpu(files_lglock, file_list_cpu(file));358392 }359393}394394+395395+#ifdef CONFIG_SMP396396+397397+/*398398+ * These macros iterate all files on all CPUs for a given superblock.399399+ * files_lglock must be held globally.400400+ */401401+#define do_file_list_for_each_entry(__sb, __file) \402402+{ \403403+ int i; \404404+ for_each_possible_cpu(i) { \405405+ struct list_head *list; \406406+ list = per_cpu_ptr((__sb)->s_files, i); \407407+ list_for_each_entry((__file), list, f_u.fu_list)408408+409409+#define while_file_list_for_each_entry \410410+ } \411411+}412412+413413+#else414414+415415+#define do_file_list_for_each_entry(__sb, __file) \416416+{ \417417+ struct list_head *list; \418418+ list = &(sb)->s_files; \419419+ list_for_each_entry((__file), list, f_u.fu_list)420420+421421+#define while_file_list_for_each_entry \422422+}423423+424424+#endif360425361426int fs_may_remount_ro(struct super_block *sb)362427{363428 struct file *file;364364-365429 /* Check that no files are currently opened for writing. */366366- file_list_lock();367367- list_for_each_entry(file, &sb->s_files, f_u.fu_list) {430430+ lg_global_lock(files_lglock);431431+ do_file_list_for_each_entry(sb, file) {368432 struct inode *inode = file->f_path.dentry->d_inode;369433370434 /* File with pending delete? */···440372 /* Writeable file? */441373 if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE))442374 goto too_bad;443443- }444444- file_list_unlock();375375+ } while_file_list_for_each_entry;376376+ lg_global_unlock(files_lglock);445377 return 1; /* Tis' cool bro. */446378too_bad:447447- file_list_unlock();379379+ lg_global_unlock(files_lglock);448380 return 0;449381}450382···460392 struct file *f;461393462394retry:463463- file_list_lock();464464- list_for_each_entry(f, &sb->s_files, f_u.fu_list) {395395+ lg_global_lock(files_lglock);396396+ do_file_list_for_each_entry(sb, f) {465397 struct vfsmount *mnt;466398 if (!S_ISREG(f->f_path.dentry->d_inode->i_mode))467399 continue;···476408 continue;477409 file_release_write(f);478410 mnt = mntget(f->f_path.mnt);479479- file_list_unlock();480480- /*481481- * This can sleep, so we can't hold482482- * the file_list_lock() spinlock.483483- */411411+ /* This can sleep, so we can't hold the spinlock. */412412+ lg_global_unlock(files_lglock);484413 mnt_drop_write(mnt);485414 mntput(mnt);486415 goto retry;487487- }488488- file_list_unlock();416416+ } while_file_list_for_each_entry;417417+ lg_global_unlock(files_lglock);489418}490419491420void __init files_init(unsigned long mempages)···502437 if (files_stat.max_files < NR_FILE)503438 files_stat.max_files = NR_FILE;504439 files_defer_init();440440+ lg_lock_init(files_lglock);505441 percpu_counter_init(&nr_files, 0);506442}
···104104 __putname(name);105105 return NULL;106106 }107107- strncpy(name, root, PATH_MAX);107107+ strlcpy(name, root, PATH_MAX);108108 if (len > p - name) {109109 __putname(name);110110 return NULL;···876876 char *path = dentry_name(dentry);877877 int err = -ENOMEM;878878 if (path) {879879- int err = hostfs_do_readlink(path, link, PATH_MAX);879879+ err = hostfs_do_readlink(path, link, PATH_MAX);880880 if (err == PATH_MAX)881881 err = -E2BIG;882882 __putname(path);
+6-1
fs/internal.h
···99 * 2 of the License, or (at your option) any later version.1010 */11111212+#include <linux/lglock.h>1313+1214struct super_block;1315struct linux_binprm;1416struct path;···72707371extern void __init mnt_init(void);74727575-extern spinlock_t vfsmount_lock;7373+DECLARE_BRLOCK(vfsmount_lock);7474+76757776/*7877 * fs_struct.c···8380/*8481 * file_table.c8582 */8383+extern void file_sb_list_add(struct file *f, struct super_block *sb);8484+extern void file_sb_list_del(struct file *f);8685extern void mark_files_ro(struct super_block *);8786extern struct file *get_empty_filp(void);8887
+3-1
fs/jbd/checkpoint.c
···254254{255255 int i;256256257257- ll_rw_block(SWRITE, *batch_count, bhs);257257+ for (i = 0; i < *batch_count; i++)258258+ write_dirty_buffer(bhs[i], WRITE);259259+258260 for (i = 0; i < *batch_count; i++) {259261 struct buffer_head *bh = bhs[i];260262 clear_buffer_jwrite(bh);
+25-24
fs/jbd/commit.c
···119119 struct buffer_head *bh;120120 journal_header_t *header;121121 int ret;122122- int barrier_done = 0;123122124123 if (is_journal_aborted(journal))125124 return 0;···136137137138 JBUFFER_TRACE(descriptor, "write commit block");138139 set_buffer_dirty(bh);140140+139141 if (journal->j_flags & JFS_BARRIER) {140140- set_buffer_ordered(bh);141141- barrier_done = 1;142142- }143143- ret = sync_dirty_buffer(bh);144144- if (barrier_done)145145- clear_buffer_ordered(bh);146146- /* is it possible for another commit to fail at roughly147147- * the same time as this one? If so, we don't want to148148- * trust the barrier flag in the super, but instead want149149- * to remember if we sent a barrier request150150- */151151- if (ret == -EOPNOTSUPP && barrier_done) {152152- char b[BDEVNAME_SIZE];142142+ ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER);153143154154- printk(KERN_WARNING155155- "JBD: barrier-based sync failed on %s - "156156- "disabling barriers\n",157157- bdevname(journal->j_dev, b));158158- spin_lock(&journal->j_state_lock);159159- journal->j_flags &= ~JFS_BARRIER;160160- spin_unlock(&journal->j_state_lock);144144+ /*145145+ * Is it possible for another commit to fail at roughly146146+ * the same time as this one? If so, we don't want to147147+ * trust the barrier flag in the super, but instead want148148+ * to remember if we sent a barrier request149149+ */150150+ if (ret == -EOPNOTSUPP) {151151+ char b[BDEVNAME_SIZE];161152162162- /* And try again, without the barrier */163163- set_buffer_uptodate(bh);164164- set_buffer_dirty(bh);153153+ printk(KERN_WARNING154154+ "JBD: barrier-based sync failed on %s - "155155+ "disabling barriers\n",156156+ bdevname(journal->j_dev, b));157157+ spin_lock(&journal->j_state_lock);158158+ journal->j_flags &= ~JFS_BARRIER;159159+ spin_unlock(&journal->j_state_lock);160160+161161+ /* And try again, without the barrier */162162+ set_buffer_uptodate(bh);163163+ set_buffer_dirty(bh);164164+ ret = sync_dirty_buffer(bh);165165+ }166166+ } else {165167 ret = sync_dirty_buffer(bh);166168 }169169+167170 put_bh(bh); /* One for getblk() */168171 journal_put_journal_head(descriptor);169172
+1-1
fs/jbd/journal.c
···10241024 if (wait)10251025 sync_dirty_buffer(bh);10261026 else10271027- ll_rw_block(SWRITE, 1, &bh);10271027+ write_dirty_buffer(bh, WRITE);1028102810291029out:10301030 /* If we have just flushed the log (by marking s_start==0), then
···255255{256256 int i;257257258258- ll_rw_block(SWRITE, *batch_count, journal->j_chkpt_bhs);258258+ for (i = 0; i < *batch_count; i++)259259+ write_dirty_buffer(journal->j_chkpt_bhs[i], WRITE);260260+259261 for (i = 0; i < *batch_count; i++) {260262 struct buffer_head *bh = journal->j_chkpt_bhs[i];261263 clear_buffer_jwrite(bh);
+15-24
fs/jbd2/commit.c
···101101 struct commit_header *tmp;102102 struct buffer_head *bh;103103 int ret;104104- int barrier_done = 0;105104 struct timespec now = current_kernel_time();106105107106 if (is_journal_aborted(journal))···135136 if (journal->j_flags & JBD2_BARRIER &&136137 !JBD2_HAS_INCOMPAT_FEATURE(journal,137138 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {138138- set_buffer_ordered(bh);139139- barrier_done = 1;140140- }141141- ret = submit_bh(WRITE_SYNC_PLUG, bh);142142- if (barrier_done)143143- clear_buffer_ordered(bh);139139+ ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh);140140+ if (ret == -EOPNOTSUPP) {141141+ printk(KERN_WARNING142142+ "JBD2: Disabling barriers on %s, "143143+ "not supported by device\n", journal->j_devname);144144+ write_lock(&journal->j_state_lock);145145+ journal->j_flags &= ~JBD2_BARRIER;146146+ write_unlock(&journal->j_state_lock);144147145145- /* is it possible for another commit to fail at roughly146146- * the same time as this one? If so, we don't want to147147- * trust the barrier flag in the super, but instead want148148- * to remember if we sent a barrier request149149- */150150- if (ret == -EOPNOTSUPP && barrier_done) {151151- printk(KERN_WARNING152152- "JBD2: Disabling barriers on %s, "153153- "not supported by device\n", journal->j_devname);154154- write_lock(&journal->j_state_lock);155155- journal->j_flags &= ~JBD2_BARRIER;156156- write_unlock(&journal->j_state_lock);157157-158158- /* And try again, without the barrier */159159- lock_buffer(bh);160160- set_buffer_uptodate(bh);161161- clear_buffer_dirty(bh);148148+ /* And try again, without the barrier */149149+ lock_buffer(bh);150150+ set_buffer_uptodate(bh);151151+ clear_buffer_dirty(bh);152152+ ret = submit_bh(WRITE_SYNC_PLUG, bh);153153+ }154154+ } else {162155 ret = submit_bh(WRITE_SYNC_PLUG, bh);163156 }164157 *cbh = bh;
+1-1
fs/jbd2/journal.c
···11241124 set_buffer_uptodate(bh);11251125 }11261126 } else11271127- ll_rw_block(SWRITE, 1, &bh);11271127+ write_dirty_buffer(bh, WRITE);1128112811291129out:11301130 /* If we have just flushed the log (by marking s_start==0), then
···8080 struct list_head c_cache_list;8181 const char *c_name;8282 atomic_t c_entry_count;8383+ int c_max_entries;8384 int c_bucket_bits;8485 struct kmem_cache *c_entry_cache;8586 struct list_head *c_block_hash;···244243 if (!cache->c_entry_cache)245244 goto fail2;246245246246+ /*247247+ * Set an upper limit on the number of cache entries so that the hash248248+ * chains won't grow too long.249249+ */250250+ cache->c_max_entries = bucket_count << 4;251251+247252 spin_lock(&mb_cache_spinlock);248253 list_add(&cache->c_cache_list, &mb_cache_list);249254 spin_unlock(&mb_cache_spinlock);···340333 kfree(cache);341334}342335343343-344336/*345337 * mb_cache_entry_alloc()346338 *···351345struct mb_cache_entry *352346mb_cache_entry_alloc(struct mb_cache *cache, gfp_t gfp_flags)353347{354354- struct mb_cache_entry *ce;348348+ struct mb_cache_entry *ce = NULL;355349356356- ce = kmem_cache_alloc(cache->c_entry_cache, gfp_flags);357357- if (ce) {350350+ if (atomic_read(&cache->c_entry_count) >= cache->c_max_entries) {351351+ spin_lock(&mb_cache_spinlock);352352+ if (!list_empty(&mb_cache_lru_list)) {353353+ ce = list_entry(mb_cache_lru_list.next,354354+ struct mb_cache_entry, e_lru_list);355355+ list_del_init(&ce->e_lru_list);356356+ __mb_cache_entry_unhash(ce);357357+ }358358+ spin_unlock(&mb_cache_spinlock);359359+ }360360+ if (!ce) {361361+ ce = kmem_cache_alloc(cache->c_entry_cache, gfp_flags);362362+ if (!ce)363363+ return NULL;358364 atomic_inc(&cache->c_entry_count);359365 INIT_LIST_HEAD(&ce->e_lru_list);360366 INIT_LIST_HEAD(&ce->e_block_list);361367 ce->e_cache = cache;362362- ce->e_used = 1 + MB_CACHE_WRITER;363368 ce->e_queued = 0;364369 }370370+ ce->e_used = 1 + MB_CACHE_WRITER;365371 return ce;366372}367373
+55-64
fs/namei.c
···595595{596596 struct vfsmount *parent;597597 struct dentry *mountpoint;598598- spin_lock(&vfsmount_lock);598598+599599+ br_read_lock(vfsmount_lock);599600 parent = path->mnt->mnt_parent;600601 if (parent == path->mnt) {601601- spin_unlock(&vfsmount_lock);602602+ br_read_unlock(vfsmount_lock);602603 return 0;603604 }604605 mntget(parent);605606 mountpoint = dget(path->mnt->mnt_mountpoint);606606- spin_unlock(&vfsmount_lock);607607+ br_read_unlock(vfsmount_lock);607608 dput(path->dentry);608609 path->dentry = mountpoint;609610 mntput(path->mnt);···687686}688687689688/*689689+ * Allocate a dentry with name and parent, and perform a parent690690+ * directory ->lookup on it. Returns the new dentry, or ERR_PTR691691+ * on error. parent->d_inode->i_mutex must be held. d_lookup must692692+ * have verified that no child exists while under i_mutex.693693+ */694694+static struct dentry *d_alloc_and_lookup(struct dentry *parent,695695+ struct qstr *name, struct nameidata *nd)696696+{697697+ struct inode *inode = parent->d_inode;698698+ struct dentry *dentry;699699+ struct dentry *old;700700+701701+ /* Don't create child dentry for a dead directory. */702702+ if (unlikely(IS_DEADDIR(inode)))703703+ return ERR_PTR(-ENOENT);704704+705705+ dentry = d_alloc(parent, name);706706+ if (unlikely(!dentry))707707+ return ERR_PTR(-ENOMEM);708708+709709+ old = inode->i_op->lookup(inode, dentry, nd);710710+ if (unlikely(old)) {711711+ dput(dentry);712712+ dentry = old;713713+ }714714+ return dentry;715715+}716716+717717+/*690718 * It's more convoluted than I'd like it to be, but... it's still fairly691719 * small and for now I'd prefer to have fast path as straight as possible.692720 * It _is_ time-critical.···736706 return err;737707 }738708709709+ /*710710+ * Rename seqlock is not required here because in the off chance711711+ * of a false negative due to a concurrent rename, we're going to712712+ * do the non-racy lookup, below.713713+ */739714 dentry = __d_lookup(nd->path.dentry, name);740715 if (!dentry)741716 goto need_lookup;717717+found:742718 if (dentry->d_op && dentry->d_op->d_revalidate)743719 goto need_revalidate;744720done:···760724 mutex_lock(&dir->i_mutex);761725 /*762726 * First re-do the cached lookup just in case it was created763763- * while we waited for the directory semaphore..727727+ * while we waited for the directory semaphore, or the first728728+ * lookup failed due to an unrelated rename.764729 *765765- * FIXME! This could use version numbering or similar to766766- * avoid unnecessary cache lookups.767767- *768768- * The "dcache_lock" is purely to protect the RCU list walker769769- * from concurrent renames at this point (we mustn't get false770770- * negatives from the RCU list walk here, unlike the optimistic771771- * fast walk).772772- *773773- * so doing d_lookup() (with seqlock), instead of lockfree __d_lookup730730+ * This could use version numbering or similar to avoid unnecessary731731+ * cache lookups, but then we'd have to do the first lookup in the732732+ * non-racy way. However in the common case here, everything should733733+ * be hot in cache, so would it be a big win?774734 */775735 dentry = d_lookup(parent, name);776776- if (!dentry) {777777- struct dentry *new;778778-779779- /* Don't create child dentry for a dead directory. */780780- dentry = ERR_PTR(-ENOENT);781781- if (IS_DEADDIR(dir))782782- goto out_unlock;783783-784784- new = d_alloc(parent, name);785785- dentry = ERR_PTR(-ENOMEM);786786- if (new) {787787- dentry = dir->i_op->lookup(dir, new, nd);788788- if (dentry)789789- dput(new);790790- else791791- dentry = new;792792- }793793-out_unlock:736736+ if (likely(!dentry)) {737737+ dentry = d_alloc_and_lookup(parent, name, nd);794738 mutex_unlock(&dir->i_mutex);795739 if (IS_ERR(dentry))796740 goto fail;797741 goto done;798742 }799799-800743 /*801744 * Uhhuh! Nasty case: the cache was re-populated while802745 * we waited on the semaphore. Need to revalidate.803746 */804747 mutex_unlock(&dir->i_mutex);805805- if (dentry->d_op && dentry->d_op->d_revalidate) {806806- dentry = do_revalidate(dentry, nd);807807- if (!dentry)808808- dentry = ERR_PTR(-ENOENT);809809- }810810- if (IS_ERR(dentry))811811- goto fail;812812- goto done;748748+ goto found;813749814750need_revalidate:815751 dentry = do_revalidate(dentry, nd);···11381130 goto out;11391131 }1140113211411141- dentry = __d_lookup(base, name);11421142-11431143- /* lockess __d_lookup may fail due to concurrent d_move()11441144- * in some unrelated directory, so try with d_lookup11331133+ /*11341134+ * Don't bother with __d_lookup: callers are for creat as11351135+ * well as unlink, so a lot of the time it would cost11361136+ * a double lookup.11451137 */11461146- if (!dentry)11471147- dentry = d_lookup(base, name);11381138+ dentry = d_lookup(base, name);1148113911491140 if (dentry && dentry->d_op && dentry->d_op->d_revalidate)11501141 dentry = do_revalidate(dentry, nd);1151114211521152- if (!dentry) {11531153- struct dentry *new;11541154-11551155- /* Don't create child dentry for a dead directory. */11561156- dentry = ERR_PTR(-ENOENT);11571157- if (IS_DEADDIR(inode))11581158- goto out;11591159-11601160- new = d_alloc(base, name);11611161- dentry = ERR_PTR(-ENOMEM);11621162- if (!new)11631163- goto out;11641164- dentry = inode->i_op->lookup(inode, new, nd);11651165- if (!dentry)11661166- dentry = new;11671167- else11681168- dput(new);11691169- }11431143+ if (!dentry)11441144+ dentry = d_alloc_and_lookup(base, name, nd);11701145out:11711146 return dentry;11721147}
+111-66
fs/namespace.c
···1111#include <linux/syscalls.h>1212#include <linux/slab.h>1313#include <linux/sched.h>1414+#include <linux/spinlock.h>1515+#include <linux/percpu.h>1416#include <linux/smp_lock.h>1517#include <linux/init.h>1618#include <linux/kernel.h>···4038#define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head))4139#define HASH_SIZE (1UL << HASH_SHIFT)42404343-/* spinlock for vfsmount related operations, inplace of dcache_lock */4444-__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);4545-4641static int event;4742static DEFINE_IDA(mnt_id_ida);4843static DEFINE_IDA(mnt_group_ida);4444+static DEFINE_SPINLOCK(mnt_id_lock);4945static int mnt_id_start = 0;5046static int mnt_group_start = 1;5147···5555struct kobject *fs_kobj;5656EXPORT_SYMBOL_GPL(fs_kobj);57575858+/*5959+ * vfsmount lock may be taken for read to prevent changes to the6060+ * vfsmount hash, ie. during mountpoint lookups or walking back6161+ * up the tree.6262+ *6363+ * It should be taken for write in all cases where the vfsmount6464+ * tree or hash is modified or when a vfsmount structure is modified.6565+ */6666+DEFINE_BRLOCK(vfsmount_lock);6767+5868static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)5969{6070 unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES);···75657666#define MNT_WRITER_UNDERFLOW_LIMIT -(1<<16)77677878-/* allocation is serialized by namespace_sem */6868+/*6969+ * allocation is serialized by namespace_sem, but we need the spinlock to7070+ * serialize with freeing.7171+ */7972static int mnt_alloc_id(struct vfsmount *mnt)8073{8174 int res;82758376retry:8477 ida_pre_get(&mnt_id_ida, GFP_KERNEL);8585- spin_lock(&vfsmount_lock);7878+ spin_lock(&mnt_id_lock);8679 res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt_id);8780 if (!res)8881 mnt_id_start = mnt->mnt_id + 1;8989- spin_unlock(&vfsmount_lock);8282+ spin_unlock(&mnt_id_lock);9083 if (res == -EAGAIN)9184 goto retry;9285···9986static void mnt_free_id(struct vfsmount *mnt)10087{10188 int id = mnt->mnt_id;102102- spin_lock(&vfsmount_lock);8989+ spin_lock(&mnt_id_lock);10390 ida_remove(&mnt_id_ida, id);10491 if (mnt_id_start > id)10592 mnt_id_start = id;106106- spin_unlock(&vfsmount_lock);9393+ spin_unlock(&mnt_id_lock);10794}1089510996/*···361348{362349 int ret = 0;363350364364- spin_lock(&vfsmount_lock);351351+ br_write_lock(vfsmount_lock);365352 mnt->mnt_flags |= MNT_WRITE_HOLD;366353 /*367354 * After storing MNT_WRITE_HOLD, we'll read the counters. This store···395382 */396383 smp_wmb();397384 mnt->mnt_flags &= ~MNT_WRITE_HOLD;398398- spin_unlock(&vfsmount_lock);385385+ br_write_unlock(vfsmount_lock);399386 return ret;400387}401388402389static void __mnt_unmake_readonly(struct vfsmount *mnt)403390{404404- spin_lock(&vfsmount_lock);391391+ br_write_lock(vfsmount_lock);405392 mnt->mnt_flags &= ~MNT_READONLY;406406- spin_unlock(&vfsmount_lock);393393+ br_write_unlock(vfsmount_lock);407394}408395409396void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb)···427414/*428415 * find the first or last mount at @dentry on vfsmount @mnt depending on429416 * @dir. If @dir is set return the first mount else return the last mount.417417+ * vfsmount_lock must be held for read or write.430418 */431419struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,432420 int dir)···457443struct vfsmount *lookup_mnt(struct path *path)458444{459445 struct vfsmount *child_mnt;460460- spin_lock(&vfsmount_lock);446446+447447+ br_read_lock(vfsmount_lock);461448 if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1)))462449 mntget(child_mnt);463463- spin_unlock(&vfsmount_lock);450450+ br_read_unlock(vfsmount_lock);464451 return child_mnt;465452}466453···470455 return mnt->mnt_ns == current->nsproxy->mnt_ns;471456}472457458458+/*459459+ * vfsmount lock must be held for write460460+ */473461static void touch_mnt_namespace(struct mnt_namespace *ns)474462{475463 if (ns) {···481463 }482464}483465466466+/*467467+ * vfsmount lock must be held for write468468+ */484469static void __touch_mnt_namespace(struct mnt_namespace *ns)485470{486471 if (ns && ns->event != event) {···492471 }493472}494473474474+/*475475+ * vfsmount lock must be held for write476476+ */495477static void detach_mnt(struct vfsmount *mnt, struct path *old_path)496478{497479 old_path->dentry = mnt->mnt_mountpoint;···506482 old_path->dentry->d_mounted--;507483}508484485485+/*486486+ * vfsmount lock must be held for write487487+ */509488void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,510489 struct vfsmount *child_mnt)511490{···517490 dentry->d_mounted++;518491}519492493493+/*494494+ * vfsmount lock must be held for write495495+ */520496static void attach_mnt(struct vfsmount *mnt, struct path *path)521497{522498 mnt_set_mountpoint(path->mnt, path->dentry, mnt);···529499}530500531501/*532532- * the caller must hold vfsmount_lock502502+ * vfsmount lock must be held for write533503 */534504static void commit_tree(struct vfsmount *mnt)535505{···653623void mntput_no_expire(struct vfsmount *mnt)654624{655625repeat:656656- if (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {657657- if (likely(!mnt->mnt_pinned)) {658658- spin_unlock(&vfsmount_lock);659659- __mntput(mnt);660660- return;661661- }662662- atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count);663663- mnt->mnt_pinned = 0;664664- spin_unlock(&vfsmount_lock);665665- acct_auto_close_mnt(mnt);666666- goto repeat;626626+ if (atomic_add_unless(&mnt->mnt_count, -1, 1))627627+ return;628628+ br_write_lock(vfsmount_lock);629629+ if (!atomic_dec_and_test(&mnt->mnt_count)) {630630+ br_write_unlock(vfsmount_lock);631631+ return;667632 }633633+ if (likely(!mnt->mnt_pinned)) {634634+ br_write_unlock(vfsmount_lock);635635+ __mntput(mnt);636636+ return;637637+ }638638+ atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count);639639+ mnt->mnt_pinned = 0;640640+ br_write_unlock(vfsmount_lock);641641+ acct_auto_close_mnt(mnt);642642+ goto repeat;668643}669669-670644EXPORT_SYMBOL(mntput_no_expire);671645672646void mnt_pin(struct vfsmount *mnt)673647{674674- spin_lock(&vfsmount_lock);648648+ br_write_lock(vfsmount_lock);675649 mnt->mnt_pinned++;676676- spin_unlock(&vfsmount_lock);650650+ br_write_unlock(vfsmount_lock);677651}678652679653EXPORT_SYMBOL(mnt_pin);680654681655void mnt_unpin(struct vfsmount *mnt)682656{683683- spin_lock(&vfsmount_lock);657657+ br_write_lock(vfsmount_lock);684658 if (mnt->mnt_pinned) {685659 atomic_inc(&mnt->mnt_count);686660 mnt->mnt_pinned--;687661 }688688- spin_unlock(&vfsmount_lock);662662+ br_write_unlock(vfsmount_lock);689663}690664691665EXPORT_SYMBOL(mnt_unpin);···780746 struct mnt_namespace *ns = p->ns;781747 int res = 0;782748783783- spin_lock(&vfsmount_lock);749749+ br_read_lock(vfsmount_lock);784750 if (p->event != ns->event) {785751 p->event = ns->event;786752 res = 1;787753 }788788- spin_unlock(&vfsmount_lock);754754+ br_read_unlock(vfsmount_lock);789755790756 return res;791757}···986952 int minimum_refs = 0;987953 struct vfsmount *p;988954989989- spin_lock(&vfsmount_lock);955955+ br_read_lock(vfsmount_lock);990956 for (p = mnt; p; p = next_mnt(p, mnt)) {991957 actual_refs += atomic_read(&p->mnt_count);992958 minimum_refs += 2;993959 }994994- spin_unlock(&vfsmount_lock);960960+ br_read_unlock(vfsmount_lock);995961996962 if (actual_refs > minimum_refs)997963 return 0;···1018984{1019985 int ret = 1;1020986 down_read(&namespace_sem);10211021- spin_lock(&vfsmount_lock);987987+ br_read_lock(vfsmount_lock);1022988 if (propagate_mount_busy(mnt, 2))1023989 ret = 0;10241024- spin_unlock(&vfsmount_lock);990990+ br_read_unlock(vfsmount_lock);1025991 up_read(&namespace_sem);1026992 return ret;1027993}···10371003 if (mnt->mnt_parent != mnt) {10381004 struct dentry *dentry;10391005 struct vfsmount *m;10401040- spin_lock(&vfsmount_lock);10061006+10071007+ br_write_lock(vfsmount_lock);10411008 dentry = mnt->mnt_mountpoint;10421009 m = mnt->mnt_parent;10431010 mnt->mnt_mountpoint = mnt->mnt_root;10441011 mnt->mnt_parent = mnt;10451012 m->mnt_ghosts--;10461046- spin_unlock(&vfsmount_lock);10131013+ br_write_unlock(vfsmount_lock);10471014 dput(dentry);10481015 mntput(m);10491016 }···10521017 }10531018}1054101910201020+/*10211021+ * vfsmount lock must be held for write10221022+ * namespace_sem must be held for write10231023+ */10551024void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)10561025{10571026 struct vfsmount *p;···11461107 }1147110811481109 down_write(&namespace_sem);11491149- spin_lock(&vfsmount_lock);11101110+ br_write_lock(vfsmount_lock);11501111 event++;1151111211521113 if (!(flags & MNT_DETACH))···11581119 umount_tree(mnt, 1, &umount_list);11591120 retval = 0;11601121 }11611161- spin_unlock(&vfsmount_lock);11221122+ br_write_unlock(vfsmount_lock);11621123 up_write(&namespace_sem);11631124 release_mounts(&umount_list);11641125 return retval;···12701231 q = clone_mnt(p, p->mnt_root, flag);12711232 if (!q)12721233 goto Enomem;12731273- spin_lock(&vfsmount_lock);12341234+ br_write_lock(vfsmount_lock);12741235 list_add_tail(&q->mnt_list, &res->mnt_list);12751236 attach_mnt(q, &path);12761276- spin_unlock(&vfsmount_lock);12371237+ br_write_unlock(vfsmount_lock);12771238 }12781239 }12791240 return res;12801241Enomem:12811242 if (res) {12821243 LIST_HEAD(umount_list);12831283- spin_lock(&vfsmount_lock);12441244+ br_write_lock(vfsmount_lock);12841245 umount_tree(res, 0, &umount_list);12851285- spin_unlock(&vfsmount_lock);12461246+ br_write_unlock(vfsmount_lock);12861247 release_mounts(&umount_list);12871248 }12881249 return NULL;···13011262{13021263 LIST_HEAD(umount_list);13031264 down_write(&namespace_sem);13041304- spin_lock(&vfsmount_lock);12651265+ br_write_lock(vfsmount_lock);13051266 umount_tree(mnt, 0, &umount_list);13061306- spin_unlock(&vfsmount_lock);12671267+ br_write_unlock(vfsmount_lock);13071268 up_write(&namespace_sem);13081269 release_mounts(&umount_list);13091270}···14311392 if (err)14321393 goto out_cleanup_ids;1433139414341434- spin_lock(&vfsmount_lock);13951395+ br_write_lock(vfsmount_lock);1435139614361397 if (IS_MNT_SHARED(dest_mnt)) {14371398 for (p = source_mnt; p; p = next_mnt(p, source_mnt))···14501411 list_del_init(&child->mnt_hash);14511412 commit_tree(child);14521413 }14531453- spin_unlock(&vfsmount_lock);14141414+ br_write_unlock(vfsmount_lock);14151415+14541416 return 0;1455141714561418 out_cleanup_ids:···15061466 goto out_unlock;15071467 }1508146815091509- spin_lock(&vfsmount_lock);14691469+ br_write_lock(vfsmount_lock);15101470 for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))15111471 change_mnt_propagation(m, type);15121512- spin_unlock(&vfsmount_lock);14721472+ br_write_unlock(vfsmount_lock);1513147315141474 out_unlock:15151475 up_write(&namespace_sem);···15531513 err = graft_tree(mnt, path);15541514 if (err) {15551515 LIST_HEAD(umount_list);15561556- spin_lock(&vfsmount_lock);15161516+15171517+ br_write_lock(vfsmount_lock);15571518 umount_tree(mnt, 0, &umount_list);15581558- spin_unlock(&vfsmount_lock);15191519+ br_write_unlock(vfsmount_lock);15591520 release_mounts(&umount_list);15601521 }15611522···16091568 else16101569 err = do_remount_sb(sb, flags, data, 0);16111570 if (!err) {16121612- spin_lock(&vfsmount_lock);15711571+ br_write_lock(vfsmount_lock);16131572 mnt_flags |= path->mnt->mnt_flags & MNT_PROPAGATION_MASK;16141573 path->mnt->mnt_flags = mnt_flags;16151615- spin_unlock(&vfsmount_lock);15741574+ br_write_unlock(vfsmount_lock);16161575 }16171576 up_write(&sb->s_umount);16181577 if (!err) {16191619- spin_lock(&vfsmount_lock);15781578+ br_write_lock(vfsmount_lock);16201579 touch_mnt_namespace(path->mnt->mnt_ns);16211621- spin_unlock(&vfsmount_lock);15801580+ br_write_unlock(vfsmount_lock);16221581 }16231582 return err;16241583}···17951754 return;1796175517971756 down_write(&namespace_sem);17981798- spin_lock(&vfsmount_lock);17571757+ br_write_lock(vfsmount_lock);1799175818001759 /* extract from the expiration list every vfsmount that matches the18011760 * following criteria:···18141773 touch_mnt_namespace(mnt->mnt_ns);18151774 umount_tree(mnt, 1, &umounts);18161775 }18171817- spin_unlock(&vfsmount_lock);17761776+ br_write_unlock(vfsmount_lock);18181777 up_write(&namespace_sem);1819177818201779 release_mounts(&umounts);···18711830/*18721831 * process a list of expirable mountpoints with the intent of discarding any18731832 * submounts of a specific parent mountpoint18331833+ *18341834+ * vfsmount_lock must be held for write18741835 */18751836static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts)18761837{···20912048 kfree(new_ns);20922049 return ERR_PTR(-ENOMEM);20932050 }20942094- spin_lock(&vfsmount_lock);20512051+ br_write_lock(vfsmount_lock);20952052 list_add_tail(&new_ns->list, &new_ns->root->mnt_list);20962096- spin_unlock(&vfsmount_lock);20532053+ br_write_unlock(vfsmount_lock);2097205420982055 /*20992056 * Second pass: switch the tsk->fs->* elements and mark new vfsmounts···22872244 goto out2; /* not attached */22882245 /* make sure we can reach put_old from new_root */22892246 tmp = old.mnt;22902290- spin_lock(&vfsmount_lock);22472247+ br_write_lock(vfsmount_lock);22912248 if (tmp != new.mnt) {22922249 for (;;) {22932250 if (tmp->mnt_parent == tmp)···23072264 /* mount new_root on / */23082265 attach_mnt(new.mnt, &root_parent);23092266 touch_mnt_namespace(current->nsproxy->mnt_ns);23102310- spin_unlock(&vfsmount_lock);22672267+ br_write_unlock(vfsmount_lock);23112268 chroot_fs_refs(&root, &new);23122269 error = 0;23132270 path_put(&root_parent);···23222279out0:23232280 return error;23242281out3:23252325- spin_unlock(&vfsmount_lock);22822282+ br_write_unlock(vfsmount_lock);23262283 goto out2;23272284}23282285···23692326 for (u = 0; u < HASH_SIZE; u++)23702327 INIT_LIST_HEAD(&mount_hashtable[u]);2371232823292329+ br_lock_init(vfsmount_lock);23302330+23722331 err = sysfs_init();23732332 if (err)23742333 printk(KERN_WARNING "%s: sysfs_init error: %d\n",···23892344 if (!atomic_dec_and_test(&ns->count))23902345 return;23912346 down_write(&namespace_sem);23922392- spin_lock(&vfsmount_lock);23472347+ br_write_lock(vfsmount_lock);23932348 umount_tree(ns->root, 0, &umount_list);23942394- spin_unlock(&vfsmount_lock);23492349+ br_write_unlock(vfsmount_lock);23952350 up_write(&namespace_sem);23962351 release_mounts(&umount_list);23972352 kfree(ns);
-1
fs/nfs/Kconfig
···6363config NFS_V46464 bool "NFS client support for NFS version 4"6565 depends on NFS_FS6666- select RPCSEC_GSS_KRB56766 help6867 This option enables support for version 4 of the NFS protocol6968 (RFC 3530) in the kernel's NFS client.
+8-1
fs/nfs/dir.c
···140140141141 /* Call generic open code in order to cache credentials */142142 res = nfs_open(inode, filp);143143+ if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) {144144+ /* This is a mountpoint, so d_revalidate will never145145+ * have been called, so we need to refresh the146146+ * inode (for close-open consistency) ourselves.147147+ */148148+ __nfs_revalidate_inode(NFS_SERVER(inode), inode);149149+ }143150 return res;144151}145152···11101103 if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))11111104 goto no_open_dput;11121105 /* We can't create new files, or truncate existing ones here */11131113- openflags &= ~(O_CREAT|O_TRUNC);11061106+ openflags &= ~(O_CREAT|O_EXCL|O_TRUNC);1114110711151108 /*11161109 * Note: we're not holding inode->i_mutex and so may be racing with
+1-1
fs/nfs/file.c
···323323 have_error |= test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags);324324 if (have_error)325325 ret = xchg(&ctx->error, 0);326326- if (!ret)326326+ if (!ret && status < 0)327327 ret = status;328328 return ret;329329}
···655655656656 if (nfss->options & NFS_OPTION_FSCACHE)657657 seq_printf(m, ",fsc");658658+659659+ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {660660+ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)661661+ seq_printf(m, ",lookupcache=none");662662+ else663663+ seq_printf(m, ",lookupcache=pos");664664+ }658665}659666660667/*
-1
fs/nfsd/Kconfig
···6969 depends on NFSD && PROC_FS && EXPERIMENTAL7070 select NFSD_V37171 select FS_POSIX_ACL7272- select RPCSEC_GSS_KRB57372 help7473 This option enables support in your system's NFS server for7574 version 4 of the NFS protocol (RFC 3530).
···126126 return 0;127127}128128129129+/*130130+ * vfsmount lock must be held for write131131+ */129132void change_mnt_propagation(struct vfsmount *mnt, int type)130133{131134 if (type == MS_SHARED) {···273270 prev_src_mnt = child;274271 }275272out:276276- spin_lock(&vfsmount_lock);273273+ br_write_lock(vfsmount_lock);277274 while (!list_empty(&tmp_list)) {278275 child = list_first_entry(&tmp_list, struct vfsmount, mnt_hash);279276 umount_tree(child, 0, &umount_list);280277 }281281- spin_unlock(&vfsmount_lock);278278+ br_write_unlock(vfsmount_lock);282279 release_mounts(&umount_list);283280 return ret;284281}···299296 * other mounts its parent propagates to.300297 * Check if any of these mounts that **do not have submounts**301298 * have more references than 'refcnt'. If so return busy.299299+ *300300+ * vfsmount lock must be held for read or write302301 */303302int propagate_mount_busy(struct vfsmount *mnt, int refcnt)304303{···358353 * collect all mounts that receive propagation from the mount in @list,359354 * and return these additional mounts in the same list.360355 * @list: the list of mounts to be unmounted.356356+ *357357+ * vfsmount lock must be held for write361358 */362359int propagate_umount(struct list_head *list)363360{
···23112311 /* flush out the real blocks */23122312 for (i = 0; i < get_desc_trans_len(desc); i++) {23132313 set_buffer_dirty(real_blocks[i]);23142314- ll_rw_block(SWRITE, 1, real_blocks + i);23142314+ write_dirty_buffer(real_blocks[i], WRITE);23152315 }23162316 for (i = 0; i < get_desc_trans_len(desc); i++) {23172317 wait_on_buffer(real_blocks[i]);
···5050 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */5151 unsigned int per_clear; /* bits to clear in current->personality */5252 int argc, envc;5353- char * filename; /* Name of binary as seen by procps */5454- char * interp; /* Name of the binary really executed. Most5353+ const char * filename; /* Name of binary as seen by procps */5454+ const char * interp; /* Name of the binary really executed. Most5555 of the time same as filename, but could be5656 different for binfmt_{misc,script} */5757 unsigned interp_flags;···126126 unsigned long stack_top,127127 int executable_stack);128128extern int bprm_mm_init(struct linux_binprm *bprm);129129-extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);129129+extern int copy_strings_kernel(int argc, const char *const *argv,130130+ struct linux_binprm *bprm);130131extern int prepare_bprm_creds(struct linux_binprm *bprm);131132extern void install_exec_creds(struct linux_binprm *bprm);132133extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
+2-2
include/linux/buffer_head.h
···3232 BH_Delay, /* Buffer is not yet allocated on disk */3333 BH_Boundary, /* Block is followed by a discontiguity */3434 BH_Write_EIO, /* I/O error on write */3535- BH_Ordered, /* ordered write */3635 BH_Eopnotsupp, /* operation not supported (barrier) */3736 BH_Unwritten, /* Buffer is allocated on disk but not written */3837 BH_Quiet, /* Buffer Error Prinks to be quiet */···124125BUFFER_FNS(Delay, delay)125126BUFFER_FNS(Boundary, boundary)126127BUFFER_FNS(Write_EIO, write_io_error)127127-BUFFER_FNS(Ordered, ordered)128128BUFFER_FNS(Eopnotsupp, eopnotsupp)129129BUFFER_FNS(Unwritten, unwritten)130130···181183void __lock_buffer(struct buffer_head *bh);182184void ll_rw_block(int, int, struct buffer_head * bh[]);183185int sync_dirty_buffer(struct buffer_head *bh);186186+int __sync_dirty_buffer(struct buffer_head *bh, int rw);187187+void write_dirty_buffer(struct buffer_head *bh, int rw);184188int submit_bh(int, struct buffer_head *);185189void write_boundary_block(struct block_device *bdev,186190 sector_t bblock, unsigned blocksize);
+7-14
include/linux/fs.h
···125125 * block layer could (in theory) choose to ignore this126126 * request if it runs into resource problems.127127 * WRITE A normal async write. Device will be plugged.128128- * SWRITE Like WRITE, but a special case for ll_rw_block() that129129- * tells it to lock the buffer first. Normally a buffer130130- * must be locked before doing IO.131128 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down132129 * the hint that someone will be waiting on this IO133130 * shortly. The device must still be unplugged explicitly,···135138 * immediately after submission. The write equivalent136139 * of READ_SYNC.137140 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.138138- * SWRITE_SYNC139139- * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.140140- * See SWRITE.141141 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all142142 * previously submitted writes must be safely on storage143143 * before this one is started. Also guarantees that when···149155#define READ 0150156#define WRITE RW_MASK151157#define READA RWA_MASK152152-#define SWRITE (WRITE | READA)153158154159#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)155160#define READ_META (READ | REQ_META)···158165#define WRITE_META (WRITE | REQ_META)159166#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \160167 REQ_HARDBARRIER)161161-#define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE)162162-#define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)163168164169/*165170 * These aren't really reads or writes, they pass down information about···920929#define f_vfsmnt f_path.mnt921930 const struct file_operations *f_op;922931 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */932932+#ifdef CONFIG_SMP933933+ int f_sb_list_cpu;934934+#endif923935 atomic_long_t f_count;924936 unsigned int f_flags;925937 fmode_t f_mode;···947953 unsigned long f_mnt_write_state;948954#endif949955};950950-extern spinlock_t files_lock;951951-#define file_list_lock() spin_lock(&files_lock);952952-#define file_list_unlock() spin_unlock(&files_lock);953956954957#define get_file(x) atomic_long_inc(&(x)->f_count)955958#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)···1337134613381347 struct list_head s_inodes; /* all inodes */13391348 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */13491349+#ifdef CONFIG_SMP13501350+ struct list_head __percpu *s_files;13511351+#else13401352 struct list_head s_files;13531353+#endif13411354 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */13421355 struct list_head s_dentry_lru; /* unused dentry lru */13431356 int s_nr_dentry_unused; /* # of dentry on lru */···21922197 __insert_inode_hash(inode, inode->i_ino);21932198}2194219921952195-extern void file_move(struct file *f, struct list_head *list);21962196-extern void file_kill(struct file *f);21972200#ifdef CONFIG_BLOCK21982201extern void submit_bio(int, struct bio *);21992202extern int bdev_read_only(struct block_device *);
···11+/*22+ * Specialised local-global spinlock. Can only be declared as global variables33+ * to avoid overhead and keep things simple (and we don't want to start using44+ * these inside dynamically allocated structures).55+ *66+ * "local/global locks" (lglocks) can be used to:77+ *88+ * - Provide fast exclusive access to per-CPU data, with exclusive access to99+ * another CPU's data allowed but possibly subject to contention, and to1010+ * provide very slow exclusive access to all per-CPU data.1111+ * - Or to provide very fast and scalable read serialisation, and to provide1212+ * very slow exclusive serialisation of data (not necessarily per-CPU data).1313+ *1414+ * Brlocks are also implemented as a short-hand notation for the latter use1515+ * case.1616+ *1717+ * Copyright 2009, 2010, Nick Piggin, Novell Inc.1818+ */1919+#ifndef __LINUX_LGLOCK_H2020+#define __LINUX_LGLOCK_H2121+2222+#include <linux/spinlock.h>2323+#include <linux/lockdep.h>2424+#include <linux/percpu.h>2525+2626+/* can make br locks by using local lock for read side, global lock for write */2727+#define br_lock_init(name) name##_lock_init()2828+#define br_read_lock(name) name##_local_lock()2929+#define br_read_unlock(name) name##_local_unlock()3030+#define br_write_lock(name) name##_global_lock_online()3131+#define br_write_unlock(name) name##_global_unlock_online()3232+3333+#define DECLARE_BRLOCK(name) DECLARE_LGLOCK(name)3434+#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)3535+3636+3737+#define lg_lock_init(name) name##_lock_init()3838+#define lg_local_lock(name) name##_local_lock()3939+#define lg_local_unlock(name) name##_local_unlock()4040+#define lg_local_lock_cpu(name, cpu) name##_local_lock_cpu(cpu)4141+#define lg_local_unlock_cpu(name, cpu) name##_local_unlock_cpu(cpu)4242+#define lg_global_lock(name) name##_global_lock()4343+#define lg_global_unlock(name) name##_global_unlock()4444+#define lg_global_lock_online(name) name##_global_lock_online()4545+#define lg_global_unlock_online(name) name##_global_unlock_online()4646+4747+#ifdef CONFIG_DEBUG_LOCK_ALLOC4848+#define LOCKDEP_INIT_MAP lockdep_init_map4949+5050+#define DEFINE_LGLOCK_LOCKDEP(name) \5151+ struct lock_class_key name##_lock_key; \5252+ struct lockdep_map name##_lock_dep_map; \5353+ EXPORT_SYMBOL(name##_lock_dep_map)5454+5555+#else5656+#define LOCKDEP_INIT_MAP(a, b, c, d)5757+5858+#define DEFINE_LGLOCK_LOCKDEP(name)5959+#endif6060+6161+6262+#define DECLARE_LGLOCK(name) \6363+ extern void name##_lock_init(void); \6464+ extern void name##_local_lock(void); \6565+ extern void name##_local_unlock(void); \6666+ extern void name##_local_lock_cpu(int cpu); \6767+ extern void name##_local_unlock_cpu(int cpu); \6868+ extern void name##_global_lock(void); \6969+ extern void name##_global_unlock(void); \7070+ extern void name##_global_lock_online(void); \7171+ extern void name##_global_unlock_online(void); \7272+7373+#define DEFINE_LGLOCK(name) \7474+ \7575+ DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \7676+ DEFINE_LGLOCK_LOCKDEP(name); \7777+ \7878+ void name##_lock_init(void) { \7979+ int i; \8080+ LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \8181+ for_each_possible_cpu(i) { \8282+ arch_spinlock_t *lock; \8383+ lock = &per_cpu(name##_lock, i); \8484+ *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \8585+ } \8686+ } \8787+ EXPORT_SYMBOL(name##_lock_init); \8888+ \8989+ void name##_local_lock(void) { \9090+ arch_spinlock_t *lock; \9191+ preempt_disable(); \9292+ rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \9393+ lock = &__get_cpu_var(name##_lock); \9494+ arch_spin_lock(lock); \9595+ } \9696+ EXPORT_SYMBOL(name##_local_lock); \9797+ \9898+ void name##_local_unlock(void) { \9999+ arch_spinlock_t *lock; \100100+ rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \101101+ lock = &__get_cpu_var(name##_lock); \102102+ arch_spin_unlock(lock); \103103+ preempt_enable(); \104104+ } \105105+ EXPORT_SYMBOL(name##_local_unlock); \106106+ \107107+ void name##_local_lock_cpu(int cpu) { \108108+ arch_spinlock_t *lock; \109109+ preempt_disable(); \110110+ rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \111111+ lock = &per_cpu(name##_lock, cpu); \112112+ arch_spin_lock(lock); \113113+ } \114114+ EXPORT_SYMBOL(name##_local_lock_cpu); \115115+ \116116+ void name##_local_unlock_cpu(int cpu) { \117117+ arch_spinlock_t *lock; \118118+ rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \119119+ lock = &per_cpu(name##_lock, cpu); \120120+ arch_spin_unlock(lock); \121121+ preempt_enable(); \122122+ } \123123+ EXPORT_SYMBOL(name##_local_unlock_cpu); \124124+ \125125+ void name##_global_lock_online(void) { \126126+ int i; \127127+ preempt_disable(); \128128+ rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \129129+ for_each_online_cpu(i) { \130130+ arch_spinlock_t *lock; \131131+ lock = &per_cpu(name##_lock, i); \132132+ arch_spin_lock(lock); \133133+ } \134134+ } \135135+ EXPORT_SYMBOL(name##_global_lock_online); \136136+ \137137+ void name##_global_unlock_online(void) { \138138+ int i; \139139+ rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \140140+ for_each_online_cpu(i) { \141141+ arch_spinlock_t *lock; \142142+ lock = &per_cpu(name##_lock, i); \143143+ arch_spin_unlock(lock); \144144+ } \145145+ preempt_enable(); \146146+ } \147147+ EXPORT_SYMBOL(name##_global_unlock_online); \148148+ \149149+ void name##_global_lock(void) { \150150+ int i; \151151+ preempt_disable(); \152152+ rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \153153+ for_each_online_cpu(i) { \154154+ arch_spinlock_t *lock; \155155+ lock = &per_cpu(name##_lock, i); \156156+ arch_spin_lock(lock); \157157+ } \158158+ } \159159+ EXPORT_SYMBOL(name##_global_lock); \160160+ \161161+ void name##_global_unlock(void) { \162162+ int i; \163163+ rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \164164+ for_each_online_cpu(i) { \165165+ arch_spinlock_t *lock; \166166+ lock = &per_cpu(name##_lock, i); \167167+ arch_spin_unlock(lock); \168168+ } \169169+ preempt_enable(); \170170+ } \171171+ EXPORT_SYMBOL(name##_global_unlock);172172+#endif
+3-1
include/linux/sched.h
···21092109extern int allow_signal(int);21102110extern int disallow_signal(int);2111211121122112-extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);21122112+extern int do_execve(const char *,21132113+ const char __user * const __user *,21142114+ const char __user * const __user *, struct pt_regs *);21132115extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);21142116struct task_struct *fork_idle(int);21152117
+3
include/linux/spi/spi.h
···213213 * @dma_alignment: SPI controller constraint on DMA buffers alignment.214214 * @mode_bits: flags understood by this controller driver215215 * @flags: other constraints relevant to this driver216216+ * @bus_lock_spinlock: spinlock for SPI bus locking217217+ * @bus_lock_mutex: mutex for SPI bus locking218218+ * @bus_lock_flag: indicates that the SPI bus is locked for exclusive use216219 * @setup: updates the device mode and clocking records used by a217220 * device's SPI controller; protocol code may call this. This218221 * must fail if an unrecognized or unsupported mode is requested.
···8282int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab)8383{8484 int ret = 0;8585- unsigned long symbolsize;8686- unsigned long offset;8585+ unsigned long symbolsize = 0;8686+ unsigned long offset = 0;8787#define knt1_size 128 /* must be >= kallsyms table size */8888 char *knt1 = NULL;8989
+2-3
kernel/exit.c
···13861386 if (!unlikely(wo->wo_flags & WNOWAIT))13871387 *p_code = 0;1388138813891389- /* don't need the RCU readlock here as we're holding a spinlock */13901390- uid = __task_cred(p)->uid;13891389+ uid = task_uid(p);13911390unlock_sig:13921391 spin_unlock_irq(&p->sighand->siglock);13931392 if (!exit_code)···14591460 }14601461 if (!unlikely(wo->wo_flags & WNOWAIT))14611462 p->signal->flags &= ~SIGNAL_STOP_CONTINUED;14621462- uid = __task_cred(p)->uid;14631463+ uid = task_uid(p);14631464 spin_unlock_irq(&p->sighand->siglock);1464146514651466 pid = task_pid_vnr(p);
+5-5
kernel/fork.c
···752752 struct fs_struct *fs = current->fs;753753 if (clone_flags & CLONE_FS) {754754 /* tsk->fs is already what we want */755755- write_lock(&fs->lock);755755+ spin_lock(&fs->lock);756756 if (fs->in_exec) {757757- write_unlock(&fs->lock);757757+ spin_unlock(&fs->lock);758758 return -EAGAIN;759759 }760760 fs->users++;761761- write_unlock(&fs->lock);761761+ spin_unlock(&fs->lock);762762 return 0;763763 }764764 tsk->fs = copy_fs_struct(fs);···1676167616771677 if (new_fs) {16781678 fs = current->fs;16791679- write_lock(&fs->lock);16791679+ spin_lock(&fs->lock);16801680 current->fs = new_fs;16811681 if (--fs->users)16821682 new_fs = NULL;16831683 else16841684 new_fs = fs;16851685- write_unlock(&fs->lock);16851685+ spin_unlock(&fs->lock);16861686 }1687168716881688 if (new_mm) {
···34633463 size_t cnt, loff_t *fpos)34643464{34653465 char *buf;34663466+ size_t written;3466346734673468 if (tracing_disabled)34683469 return -EINVAL;···34853484 } else34863485 buf[cnt] = '\0';3487348634883488- cnt = mark_printk("%s", buf);34873487+ written = mark_printk("%s", buf);34893488 kfree(buf);34903490- *fpos += cnt;34893489+ *fpos += written;3491349034923492- return cnt;34913491+ /* don't tell userspace we wrote more - it might confuse them */34923492+ if (written > cnt)34933493+ written = cnt;34943494+34953495+ return written;34933496}3494349734953498static int tracing_clock_show(struct seq_file *m, void *v)
+149-70
kernel/trace/trace_events.c
···598598 return ret;599599}600600601601-static void print_event_fields(struct trace_seq *s, struct list_head *head)601601+enum {602602+ FORMAT_HEADER = 1,603603+ FORMAT_PRINTFMT = 2,604604+};605605+606606+static void *f_next(struct seq_file *m, void *v, loff_t *pos)602607{608608+ struct ftrace_event_call *call = m->private;603609 struct ftrace_event_field *field;610610+ struct list_head *head;604611605605- list_for_each_entry_reverse(field, head, link) {606606- /*607607- * Smartly shows the array type(except dynamic array).608608- * Normal:609609- * field:TYPE VAR610610- * If TYPE := TYPE[LEN], it is shown:611611- * field:TYPE VAR[LEN]612612- */613613- const char *array_descriptor = strchr(field->type, '[');612612+ (*pos)++;614613615615- if (!strncmp(field->type, "__data_loc", 10))616616- array_descriptor = NULL;614614+ switch ((unsigned long)v) {615615+ case FORMAT_HEADER:616616+ head = &ftrace_common_fields;617617618618- if (!array_descriptor) {619619- trace_seq_printf(s, "\tfield:%s %s;\toffset:%u;"620620- "\tsize:%u;\tsigned:%d;\n",621621- field->type, field->name, field->offset,622622- field->size, !!field->is_signed);623623- } else {624624- trace_seq_printf(s, "\tfield:%.*s %s%s;\toffset:%u;"625625- "\tsize:%u;\tsigned:%d;\n",626626- (int)(array_descriptor - field->type),627627- field->type, field->name,628628- array_descriptor, field->offset,629629- field->size, !!field->is_signed);630630- }618618+ if (unlikely(list_empty(head)))619619+ return NULL;620620+621621+ field = list_entry(head->prev, struct ftrace_event_field, link);622622+ return field;623623+624624+ case FORMAT_PRINTFMT:625625+ /* all done */626626+ return NULL;631627 }628628+629629+ head = trace_get_fields(call);630630+631631+ /*632632+ * To separate common fields from event fields, the633633+ * LSB is set on the first event field. Clear it in case.634634+ */635635+ v = (void *)((unsigned long)v & ~1L);636636+637637+ field = v;638638+ /*639639+ * If this is a common field, and at the end of the list, then640640+ * continue with main list.641641+ */642642+ if (field->link.prev == &ftrace_common_fields) {643643+ if (unlikely(list_empty(head)))644644+ return NULL;645645+ field = list_entry(head->prev, struct ftrace_event_field, link);646646+ /* Set the LSB to notify f_show to print an extra newline */647647+ field = (struct ftrace_event_field *)648648+ ((unsigned long)field | 1);649649+ return field;650650+ }651651+652652+ /* If we are done tell f_show to print the format */653653+ if (field->link.prev == head)654654+ return (void *)FORMAT_PRINTFMT;655655+656656+ field = list_entry(field->link.prev, struct ftrace_event_field, link);657657+658658+ return field;632659}633660634634-static ssize_t635635-event_format_read(struct file *filp, char __user *ubuf, size_t cnt,636636- loff_t *ppos)661661+static void *f_start(struct seq_file *m, loff_t *pos)637662{638638- struct ftrace_event_call *call = filp->private_data;639639- struct list_head *head;640640- struct trace_seq *s;641641- char *buf;642642- int r;663663+ loff_t l = 0;664664+ void *p;643665644644- if (*ppos)666666+ /* Start by showing the header */667667+ if (!*pos)668668+ return (void *)FORMAT_HEADER;669669+670670+ p = (void *)FORMAT_HEADER;671671+ do {672672+ p = f_next(m, p, &l);673673+ } while (p && l < *pos);674674+675675+ return p;676676+}677677+678678+static int f_show(struct seq_file *m, void *v)679679+{680680+ struct ftrace_event_call *call = m->private;681681+ struct ftrace_event_field *field;682682+ const char *array_descriptor;683683+684684+ switch ((unsigned long)v) {685685+ case FORMAT_HEADER:686686+ seq_printf(m, "name: %s\n", call->name);687687+ seq_printf(m, "ID: %d\n", call->event.type);688688+ seq_printf(m, "format:\n");645689 return 0;646690647647- s = kmalloc(sizeof(*s), GFP_KERNEL);648648- if (!s)649649- return -ENOMEM;650650-651651- trace_seq_init(s);652652-653653- trace_seq_printf(s, "name: %s\n", call->name);654654- trace_seq_printf(s, "ID: %d\n", call->event.type);655655- trace_seq_printf(s, "format:\n");656656-657657- /* print common fields */658658- print_event_fields(s, &ftrace_common_fields);659659-660660- trace_seq_putc(s, '\n');661661-662662- /* print event specific fields */663663- head = trace_get_fields(call);664664- print_event_fields(s, head);665665-666666- r = trace_seq_printf(s, "\nprint fmt: %s\n", call->print_fmt);667667-668668- if (!r) {669669- /*670670- * ug! The format output is bigger than a PAGE!!671671- */672672- buf = "FORMAT TOO BIG\n";673673- r = simple_read_from_buffer(ubuf, cnt, ppos,674674- buf, strlen(buf));675675- goto out;691691+ case FORMAT_PRINTFMT:692692+ seq_printf(m, "\nprint fmt: %s\n",693693+ call->print_fmt);694694+ return 0;676695 }677696678678- r = simple_read_from_buffer(ubuf, cnt, ppos,679679- s->buffer, s->len);680680- out:681681- kfree(s);682682- return r;697697+ /*698698+ * To separate common fields from event fields, the699699+ * LSB is set on the first event field. Clear it and700700+ * print a newline if it is set.701701+ */702702+ if ((unsigned long)v & 1) {703703+ seq_putc(m, '\n');704704+ v = (void *)((unsigned long)v & ~1L);705705+ }706706+707707+ field = v;708708+709709+ /*710710+ * Smartly shows the array type(except dynamic array).711711+ * Normal:712712+ * field:TYPE VAR713713+ * If TYPE := TYPE[LEN], it is shown:714714+ * field:TYPE VAR[LEN]715715+ */716716+ array_descriptor = strchr(field->type, '[');717717+718718+ if (!strncmp(field->type, "__data_loc", 10))719719+ array_descriptor = NULL;720720+721721+ if (!array_descriptor)722722+ seq_printf(m, "\tfield:%s %s;\toffset:%u;\tsize:%u;\tsigned:%d;\n",723723+ field->type, field->name, field->offset,724724+ field->size, !!field->is_signed);725725+ else726726+ seq_printf(m, "\tfield:%.*s %s%s;\toffset:%u;\tsize:%u;\tsigned:%d;\n",727727+ (int)(array_descriptor - field->type),728728+ field->type, field->name,729729+ array_descriptor, field->offset,730730+ field->size, !!field->is_signed);731731+732732+ return 0;733733+}734734+735735+static void f_stop(struct seq_file *m, void *p)736736+{737737+}738738+739739+static const struct seq_operations trace_format_seq_ops = {740740+ .start = f_start,741741+ .next = f_next,742742+ .stop = f_stop,743743+ .show = f_show,744744+};745745+746746+static int trace_format_open(struct inode *inode, struct file *file)747747+{748748+ struct ftrace_event_call *call = inode->i_private;749749+ struct seq_file *m;750750+ int ret;751751+752752+ ret = seq_open(file, &trace_format_seq_ops);753753+ if (ret < 0)754754+ return ret;755755+756756+ m = file->private_data;757757+ m->private = call;758758+759759+ return 0;683760}684761685762static ssize_t···954877};955878956879static const struct file_operations ftrace_event_format_fops = {957957- .open = tracing_open_generic,958958- .read = event_format_read,880880+ .open = trace_format_open,881881+ .read = seq_read,882882+ .llseek = seq_lseek,883883+ .release = seq_release,959884};960885961886static const struct file_operations ftrace_event_id_fops = {
+9-1
kernel/trace/trace_functions_graph.c
···507507 * if the output fails.508508 */509509 data->ent = *curr;510510- data->ret = *next;510510+ /*511511+ * If the next event is not a return type, then512512+ * we only care about what type it is. Otherwise we can513513+ * safely copy the entire event.514514+ */515515+ if (next->ent.type == TRACE_GRAPH_RET)516516+ data->ret = *next;517517+ else518518+ data->ret.ent.type = next->ent.type;511519 }512520 }513521
+4-1
lib/Kconfig.debug
···994994995995config LATENCYTOP996996 bool "Latency measuring infrastructure"997997+ depends on HAVE_LATENCYTOP_SUPPORT998998+ depends on DEBUG_KERNEL999999+ depends on STACKTRACE_SUPPORT10001000+ depends on PROC_FS9971001 select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE9981002 select KALLSYMS9991003 select KALLSYMS_ALL10001004 select STACKTRACE10011005 select SCHEDSTATS10021006 select SCHED_DEBUG10031003- depends on HAVE_LATENCYTOP_SUPPORT10041007 help10051008 Enable this option if you want to use the LatencyTOP tool10061009 to find out which userspace is blocking on what kernel operations.
···1818 If unsure, say N.19192020config RPCSEC_GSS_KRB52121- tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)"2222- depends on SUNRPC && EXPERIMENTAL2121+ tristate2222+ depends on SUNRPC && CRYPTO2323+ prompt "Secure RPC: Kerberos V mechanism" if !(NFS_V4 || NFSD_V4)2424+ default y2325 select SUNRPC_GSS2424- select CRYPTO2526 select CRYPTO_MD52627 select CRYPTO_DES2728 select CRYPTO_CBC···3534 available from http://linux-nfs.org/. In addition, user-space3635 Kerberos support should be installed.37363838- If unsure, say N.3737+ If unsure, say Y.39384039config RPCSEC_GSS_SPKM34140 tristate "Secure RPC: SPKM3 mechanism (EXPERIMENTAL)"
+2
net/sunrpc/xprtrdma/rpc_rdma.c
···249249 req->rl_nchunks = nchunks;250250251251 BUG_ON(nchunks == 0);252252+ BUG_ON((r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR)253253+ && (nchunks > 3));252254253255 /*254256 * finish off header. If write, marshal discrim and nchunks.
+17-5
net/sunrpc/xprtrdma/verbs.c
···650650 ep->rep_attr.cap.max_send_wr = cdata->max_requests;651651 switch (ia->ri_memreg_strategy) {652652 case RPCRDMA_FRMR:653653- /* Add room for frmr register and invalidate WRs */654654- ep->rep_attr.cap.max_send_wr *= 3;655655- if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr)656656- return -EINVAL;653653+ /* Add room for frmr register and invalidate WRs.654654+ * 1. FRMR reg WR for head655655+ * 2. FRMR invalidate WR for head656656+ * 3. FRMR reg WR for pagelist657657+ * 4. FRMR invalidate WR for pagelist658658+ * 5. FRMR reg WR for tail659659+ * 6. FRMR invalidate WR for tail660660+ * 7. The RDMA_SEND WR661661+ */662662+ ep->rep_attr.cap.max_send_wr *= 7;663663+ if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) {664664+ cdata->max_requests = devattr.max_qp_wr / 7;665665+ if (!cdata->max_requests)666666+ return -EINVAL;667667+ ep->rep_attr.cap.max_send_wr = cdata->max_requests * 7;668668+ }657669 break;658670 case RPCRDMA_MEMWINDOWS_ASYNC:659671 case RPCRDMA_MEMWINDOWS:···15021490 memset(&frmr_wr, 0, sizeof frmr_wr);15031491 frmr_wr.opcode = IB_WR_FAST_REG_MR;15041492 frmr_wr.send_flags = 0; /* unsignaled */15051505- frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma;14931493+ frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma;15061494 frmr_wr.wr.fast_reg.page_list = seg1->mr_chunk.rl_mw->r.frmr.fr_pgl;15071495 frmr_wr.wr.fast_reg.page_list_len = i;15081496 frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
+22-6
net/sunrpc/xprtsock.c
···13051305 if (!(xprt = xprt_from_sock(sk)))13061306 goto out;13071307 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);13081308- dprintk("RPC: state %x conn %d dead %d zapped %d\n",13081308+ dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n",13091309 sk->sk_state, xprt_connected(xprt),13101310 sock_flag(sk, SOCK_DEAD),13111311- sock_flag(sk, SOCK_ZAPPED));13111311+ sock_flag(sk, SOCK_ZAPPED),13121312+ sk->sk_shutdown);1312131313131314 switch (sk->sk_state) {13141315 case TCP_ESTABLISHED:···17801779{17811780 unsigned int state = transport->inet->sk_state;1782178117831783- if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)17841784- return;17851785- if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))17861786- return;17821782+ if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) {17831783+ /* we don't need to abort the connection if the socket17841784+ * hasn't undergone a shutdown17851785+ */17861786+ if (transport->inet->sk_shutdown == 0)17871787+ return;17881788+ dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set to %d\n",17891789+ __func__, transport->inet->sk_shutdown);17901790+ }17911791+ if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) {17921792+ /* we don't need to abort the connection if the socket17931793+ * hasn't undergone a shutdown17941794+ */17951795+ if (transport->inet->sk_shutdown == 0)17961796+ return;17971797+ dprintk("RPC: %s: ESTABLISHED/SYN_SENT "17981798+ "sk_shutdown set to %d\n",17991799+ __func__, transport->inet->sk_shutdown);18001800+ }17871801 xs_abort_connection(xprt, transport);17881802}17891803
+1-1
net/xfrm/xfrm_user.c
···25042504 if (p->dir > XFRM_POLICY_OUT)25052505 return NULL;2506250625072507- xp = xfrm_policy_alloc(net, GFP_KERNEL);25072507+ xp = xfrm_policy_alloc(net, GFP_ATOMIC);25082508 if (xp == NULL) {25092509 *dir = -ENOBUFS;25102510 return NULL;
+6-1
scripts/recordmcount.pl
···159159my $function_regex; # Find the name of a function160160 # (return offset and func name)161161my $mcount_regex; # Find the call site to mcount (return offset)162162+my $mcount_adjust; # Address adjustment to mcount offset162163my $alignment; # The .align value to use for $mcount_section163164my $section_type; # Section header plus possible alignment command164165my $can_use_local = 0; # If we can use local function references···214213$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";215214$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";216215$section_type = '@progbits';216216+$mcount_adjust = 0;217217$type = ".long";218218219219if ($arch eq "x86_64") {···353351} elsif ($arch eq "microblaze") {354352 # Microblaze calls '_mcount' instead of plain 'mcount'.355353 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";354354+} elsif ($arch eq "blackfin") {355355+ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";356356+ $mcount_adjust = -4;356357} else {357358 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";358359}···516511 }517512 # is this a call site to mcount? If so, record it to print later518513 if ($text_found && /$mcount_regex/) {519519- push(@offsets, hex $1);514514+ push(@offsets, (hex $1) + $mcount_adjust);520515 }521516}522517
+2-2
security/apparmor/lsm.c
···607607 return error;608608}609609610610-static int apparmor_task_setrlimit(unsigned int resource,611611- struct rlimit *new_rlim)610610+static int apparmor_task_setrlimit(struct task_struct *task,611611+ unsigned int resource, struct rlimit *new_rlim)612612{613613 struct aa_profile *profile = aa_current_profile();614614 int error = 0;
+2-7
security/apparmor/path.c
···6262 int deleted, connected;6363 int error = 0;64646565- /* Get the root we want to resolve too */6565+ /* Get the root we want to resolve too, released below */6666 if (flags & PATH_CHROOT_REL) {6767 /* resolve paths relative to chroot */6868- read_lock(¤t->fs->lock);6969- root = current->fs->root;7070- /* released below */7171- path_get(&root);7272- read_unlock(¤t->fs->lock);6868+ get_fs_root(current->fs, &root);7369 } else {7470 /* resolve paths relative to namespace */7571 root.mnt = current->nsproxy->mnt_ns->root;7672 root.dentry = root.mnt->mnt_root;7777- /* released below */7873 path_get(&root);7974 }8075
+1-1
security/commoncap.c
···4040 *4141 * Warn if that happens, once per boot.4242 */4343-static void warn_setuid_and_fcaps_mixed(char *fname)4343+static void warn_setuid_and_fcaps_mixed(const char *fname)4444{4545 static int warned;4646 if (!warned) {
+6-3
security/selinux/hooks.c
···2170217021712171 tty = get_current_tty();21722172 if (tty) {21732173- file_list_lock();21732173+ spin_lock(&tty_files_lock);21742174 if (!list_empty(&tty->tty_files)) {21752175+ struct tty_file_private *file_priv;21752176 struct inode *inode;2176217721772178 /* Revalidate access to controlling tty.···21802179 than using file_has_perm, as this particular open21812180 file may belong to another process and we are only21822181 interested in the inode-based check here. */21832183- file = list_first_entry(&tty->tty_files, struct file, f_u.fu_list);21822182+ file_priv = list_first_entry(&tty->tty_files,21832183+ struct tty_file_private, list);21842184+ file = file_priv->file;21842185 inode = file->f_path.dentry->d_inode;21852186 if (inode_has_perm(cred, inode,21862187 FILE__READ | FILE__WRITE, NULL)) {21872188 drop_tty = 1;21882189 }21892190 }21902190- file_list_unlock();21912191+ spin_unlock(&tty_files_lock);21912192 tty_kref_put(tty);21922193 }21932194 /* Reset controlling tty. */
+4
sound/core/pcm_native.c
···978978{979979 if (substream->runtime->trigger_master != substream)980980 return 0;981981+ /* some drivers might use hw_ptr to recover from the pause -982982+ update the hw_ptr now */983983+ if (push)984984+ snd_pcm_update_hw_ptr(substream);981985 /* The jiffies check in snd_pcm_update_hw_ptr*() is done by982986 * a delta betwen the current jiffies, this gives a large enough983987 * delta, effectively to skip the check once.
+4
sound/pci/emu10k1/emu10k1.c
···5252static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};5353static int enable_ir[SNDRV_CARDS];5454static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */5555+static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};55565657module_param_array(index, int, NULL, 0444);5758MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");···7473MODULE_PARM_DESC(enable_ir, "Enable IR.");7574module_param_array(subsystem, uint, NULL, 0444);7675MODULE_PARM_DESC(subsystem, "Force card subsystem model.");7676+module_param_array(delay_pcm_irq, uint, NULL, 0444);7777+MODULE_PARM_DESC(delay_pcm_irq, "Delay PCM interrupt by specified number of samples (default 0).");7778/*7879 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB04007980 */···130127 &emu)) < 0)131128 goto error;132129 card->private_data = emu;130130+ emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;133131 if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0)134132 goto error;135133 if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0)
···12241224 firmware.firmware.ASIC, firmware.firmware.CODEC,12251225 firmware.firmware.AUXDSP, firmware.firmware.PROG);1226122612271227+ if (!chip)12281228+ return 1;12291229+12271230 for (i = 0; i < FIRMWARE_VERSIONS; i++) {12281231 if (!memcmp(&firmware_versions[i], &firmware, sizeof(firmware)))12291229- break;12301230- }12311231- if (i >= FIRMWARE_VERSIONS)12321232- return 0; /* no match */12321232+ return 1; /* OK */1233123312341234- if (!chip)12351235- return 1; /* OK */12341234+ }1236123512371236 snd_printdd("Writing Firmware\n");12381237 if (!chip->fw_entry) {
-7
sound/soc/codecs/wm8776.c
···178178 case SND_SOC_DAIFMT_LEFT_J:179179 iface |= 0x0001;180180 break;181181- /* FIXME: CHECK A/B */182182- case SND_SOC_DAIFMT_DSP_A:183183- iface |= 0x0003;184184- break;185185- case SND_SOC_DAIFMT_DSP_B:186186- iface |= 0x0007;187187- break;188181 default:189182 return -EINVAL;190183 }
+10-6
tools/perf/Makefile
···157157#158158# Define NO_DWARF if you do not want debug-info analysis feature at all.159159160160-$(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null)161161-$(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null)162162-$(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null)163163-164160$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE165161 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)166162-include $(OUTPUT)PERF-VERSION-FILE···181185ifeq ($(ARCH),x86_64)182186 ARCH := x86183187endif184184-185185-$(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null)186188187189# CFLAGS and LDFLAGS are for the users to override from the command line.188190···262268CC = $(CROSS_COMPILE)gcc263269AR = $(CROSS_COMPILE)ar264270RM = rm -f271271+MKDIR = mkdir265272TAR = tar266273FIND = find267274INSTALL = install···833838 QUIET_CC = @echo ' ' CC $@;834839 QUIET_AR = @echo ' ' AR $@;835840 QUIET_LINK = @echo ' ' LINK $@;841841+ QUIET_MKDIR = @echo ' ' MKDIR $@;836842 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;837843 QUIET_GEN = @echo ' ' GEN $@;838844 QUIET_SUBDIR0 = +@subdir=···10071011$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)10081012$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)10091013builtin-revert.o wt-status.o: wt-status.h10141014+10151015+# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So10161016+# we depend the various files onto their directories.10171017+DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h10181018+$(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS)))10191019+# In the second step, we make a rule to actually create these directories10201020+$(sort $(dir $(DIRECTORY_DEPS))):10211021+ $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null1010102210111023$(LIB_FILE): $(LIB_OBJS)10121024 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)