aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS176
-rw-r--r--Makefile2
-rw-r--r--arch/arm/mach-davinci/psc.c3
-rw-r--r--arch/arm/mach-sa1100/include/mach/jornada720.h11
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c10
-rw-r--r--arch/arm/plat-omap/devices.c13
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c2
-rw-r--r--arch/avr32/boot/images/.gitignore4
-rw-r--r--arch/avr32/kernel/.gitignore1
-rw-r--r--arch/avr32/kernel/avr32_ksyms.c1
-rw-r--r--arch/avr32/kernel/syscall-stubs.S9
-rw-r--r--arch/avr32/kernel/syscall_table.S2
-rw-r--r--arch/avr32/kernel/traps.c8
-rw-r--r--arch/avr32/lib/findbit.S30
-rw-r--r--arch/ia64/kvm/kvm-ia64.c7
-rw-r--r--arch/mips/kernel/cpu-probe.c16
-rw-r--r--arch/mips/kernel/genex.S37
-rw-r--r--arch/mips/kernel/process.c2
-rw-r--r--arch/mips/kernel/traps.c22
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/mips/lib/csum_partial.S21
-rw-r--r--arch/mips/vr41xx/common/irq.c6
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts8
-rw-r--r--arch/powerpc/include/asm/elf.h7
-rw-r--r--arch/powerpc/include/asm/sections.h12
-rw-r--r--arch/powerpc/kernel/module_64.c19
-rw-r--r--arch/sparc64/kernel/irq.c5
-rw-r--r--arch/sparc64/kernel/pci_psycho.c8
-rw-r--r--arch/sparc64/kernel/traps.c3
-rw-r--r--arch/x86/kernel/cpu/common.c24
-rw-r--r--arch/x86/kernel/kdebugfs.c1
-rw-r--r--arch/x86/kernel/setup.c5
-rw-r--r--arch/x86/mm/init_32.c4
-rw-r--r--arch/x86/xen/setup.c2
-rw-r--r--drivers/clocksource/acpi_pm.c21
-rw-r--r--drivers/hwmon/ad7414.c2
-rw-r--r--drivers/hwmon/atxp1.c18
-rw-r--r--drivers/hwmon/it87.c4
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c6
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c11
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c31
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/mmc/card/block.c9
-rw-r--r--drivers/mmc/card/mmc_test.c4
-rw-r--r--drivers/mmc/host/atmel-mci.c12
-rw-r--r--drivers/mmc/host/tmio_mmc.h4
-rw-r--r--drivers/net/bnx2.h2
-rw-r--r--drivers/net/e100.c4
-rw-r--r--drivers/net/e1000/e1000_hw.c23
-rw-r--r--drivers/net/forcedeth.c16
-rw-r--r--drivers/net/hp-plus.c8
-rw-r--r--drivers/net/mlx4/mr.c10
-rw-r--r--drivers/net/wireless/b43/rfkill.c18
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c18
-rw-r--r--drivers/s390/cio/ccwgroup.c4
-rw-r--r--drivers/s390/cio/cio.c1
-rw-r--r--fs/Kconfig30
-rw-r--r--fs/Makefile3
-rw-r--r--fs/lockd/Makefile2
-rw-r--r--fs/lockd/clntlock.c13
-rw-r--r--fs/lockd/grace.c59
-rw-r--r--fs/lockd/host.c350
-rw-r--r--fs/lockd/mon.c2
-rw-r--r--fs/lockd/svc.c88
-rw-r--r--fs/lockd/svc4proc.c31
-rw-r--r--fs/lockd/svclock.c18
-rw-r--r--fs/lockd/svcproc.c31
-rw-r--r--fs/lockd/svcsubs.c2
-rw-r--r--fs/lockd/xdr.c2
-rw-r--r--fs/lockd/xdr4.c2
-rw-r--r--fs/nfs/callback.c3
-rw-r--r--fs/nfsd/lockd.c1
-rw-r--r--fs/nfsd/nfs3proc.c8
-rw-r--r--fs/nfsd/nfs4callback.c7
-rw-r--r--fs/nfsd/nfs4proc.c8
-rw-r--r--fs/nfsd/nfs4state.c34
-rw-r--r--fs/nfsd/nfs4xdr.c171
-rw-r--r--fs/nfsd/nfsctl.c5
-rw-r--r--fs/nfsd/nfsfh.c30
-rw-r--r--fs/nfsd/nfsproc.c6
-rw-r--r--fs/nfsd/nfssvc.c20
-rw-r--r--fs/nfsd/vfs.c63
-rw-r--r--fs/proc/proc_misc.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c20
-rw-r--r--fs/xfs/xfs_buf_item.c44
-rw-r--r--fs/xfs/xfs_dfrag.c9
-rw-r--r--fs/xfs/xfs_log.c62
-rw-r--r--fs/xfs/xfs_log_priv.h1
-rw-r--r--fs/xfs/xfs_vnodeops.c26
-rw-r--r--include/asm-generic/bug.h10
-rw-r--r--include/linux/fs.h65
-rw-r--r--include/linux/lockd/bind.h11
-rw-r--r--include/linux/lockd/lockd.h137
-rw-r--r--include/linux/lockd/xdr.h2
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/nfsd/nfsd.h3
-rw-r--r--include/linux/pnp.h7
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/svc.h19
-rw-r--r--include/linux/sunrpc/svcsock.h5
-rw-r--r--kernel/sched.c6
-rw-r--r--kernel/sched_rt.c1
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--kernel/sysctl.c6
-rw-r--r--kernel/time/clockevents.c12
-rw-r--r--kernel/time/tick-broadcast.c9
-rw-r--r--kernel/time/tick-common.c4
-rw-r--r--kernel/time/tick-internal.h2
-rw-r--r--mm/slub.c1
-rw-r--r--net/ipv4/udp.c62
-rw-r--r--net/sched/sch_generic.c3
-rw-r--r--net/sctp/associola.c9
-rw-r--r--net/sctp/output.c3
-rw-r--r--net/sctp/sm_make_chunk.c15
-rw-r--r--net/sunrpc/clnt.c2
-rw-r--r--net/sunrpc/rpcb_clnt.c81
-rw-r--r--net/sunrpc/svc.c251
-rw-r--r--net/sunrpc/svc_xprt.c39
-rw-r--r--net/sunrpc/svcsock.c17
123 files changed, 1756 insertions, 916 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 0a613cb926c6..cad81a24e832 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -271,20 +271,20 @@ W: http://www.lesswatts.org/projects/acpi/
271S: Supported 271S: Supported
272 272
273ACPI WMI DRIVER 273ACPI WMI DRIVER
274P: Carlos Corbacho 274P: Carlos Corbacho
275M: carlos@strangeworlds.co.uk 275M: carlos@strangeworlds.co.uk
276L: linux-acpi@vger.kernel.org 276L: linux-acpi@vger.kernel.org
277W: http://www.lesswatts.org/projects/acpi/ 277W: http://www.lesswatts.org/projects/acpi/
278S: Maintained 278S: Maintained
279 279
280AD1889 ALSA SOUND DRIVER 280AD1889 ALSA SOUND DRIVER
281P: Kyle McMartin 281P: Kyle McMartin
282M: kyle@mcmartin.ca 282M: kyle@mcmartin.ca
283P: Thibaut Varene 283P: Thibaut Varene
284M: T-Bone@parisc-linux.org 284M: T-Bone@parisc-linux.org
285W: http://wiki.parisc-linux.org/AD1889 285W: http://wiki.parisc-linux.org/AD1889
286L: linux-parisc@vger.kernel.org 286L: linux-parisc@vger.kernel.org
287S: Maintained 287S: Maintained
288 288
289ADM1025 HARDWARE MONITOR DRIVER 289ADM1025 HARDWARE MONITOR DRIVER
290P: Jean Delvare 290P: Jean Delvare
@@ -473,11 +473,11 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
473S: Maintained 473S: Maintained
474 474
475ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 475ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
476P: Andrew Victor 476P: Andrew Victor
477M: linux@maxim.org.za 477M: linux@maxim.org.za
478L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 478L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
479W: http://maxim.org.za/at91_26.html 479W: http://maxim.org.za/at91_26.html
480S: Maintained 480S: Maintained
481 481
482ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE 482ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
483P: Lennert Buytenhek 483P: Lennert Buytenhek
@@ -532,10 +532,10 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
532S: Maintained 532S: Maintained
533 533
534ARM/HP JORNADA 7XX MACHINE SUPPORT 534ARM/HP JORNADA 7XX MACHINE SUPPORT
535P: Kristoffer Ericson 535P: Kristoffer Ericson
536M: kristoffer.ericson@gmail.com 536M: kristoffer.ericson@gmail.com
537W: www.jlime.com 537W: www.jlime.com
538S: Maintained 538S: Maintained
539 539
540ARM/INTEL IOP32X ARM ARCHITECTURE 540ARM/INTEL IOP32X ARM ARCHITECTURE
541P: Lennert Buytenhek 541P: Lennert Buytenhek
@@ -1017,7 +1017,7 @@ T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
1017S: Maintained 1017S: Maintained
1018 1018
1019CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER 1019CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER
1020P: Jonathan Corbet 1020P: Jonathan Corbet
1021M: corbet@lwn.net 1021M: corbet@lwn.net
1022L: video4linux-list@redhat.com 1022L: video4linux-list@redhat.com
1023S: Maintained 1023S: Maintained
@@ -1359,7 +1359,7 @@ P: Digi International, Inc
1359M: Eng.Linux@digi.com 1359M: Eng.Linux@digi.com
1360L: Eng.Linux@digi.com 1360L: Eng.Linux@digi.com
1361W: http://www.digi.com 1361W: http://www.digi.com
1362S: Orphaned 1362S: Orphan
1363 1363
1364DIRECTORY NOTIFICATION 1364DIRECTORY NOTIFICATION
1365P: Stephen Rothwell 1365P: Stephen Rothwell
@@ -1423,12 +1423,12 @@ L: linux-acpi@vger.kernel.org
1423S: Supported 1423S: Supported
1424 1424
1425DOCUMENTATION (/Documentation directory) 1425DOCUMENTATION (/Documentation directory)
1426P: Michael Kerrisk 1426P: Michael Kerrisk
1427M: mtk.manpages@gmail.com 1427M: mtk.manpages@gmail.com
1428P: Randy Dunlap 1428P: Randy Dunlap
1429M: rdunlap@xenotime.net 1429M: rdunlap@xenotime.net
1430L: linux-doc@vger.kernel.org 1430L: linux-doc@vger.kernel.org
1431S: Maintained 1431S: Maintained
1432 1432
1433DOUBLETALK DRIVER 1433DOUBLETALK DRIVER
1434P: James R. Van Zandt 1434P: James R. Van Zandt
@@ -1459,7 +1459,7 @@ S: Maintained
1459DVB SUBSYSTEM AND DRIVERS 1459DVB SUBSYSTEM AND DRIVERS
1460P: LinuxTV.org Project 1460P: LinuxTV.org Project
1461M: v4l-dvb-maintainer@linuxtv.org 1461M: v4l-dvb-maintainer@linuxtv.org
1462L: linux-dvb@linuxtv.org (subscription required) 1462L: linux-dvb@linuxtv.org (subscription required)
1463W: http://linuxtv.org/ 1463W: http://linuxtv.org/
1464T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 1464T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
1465S: Maintained 1465S: Maintained
@@ -1797,7 +1797,7 @@ FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
1797P: Rik Faith 1797P: Rik Faith
1798M: faith@cs.unc.edu 1798M: faith@cs.unc.edu
1799L: linux-scsi@vger.kernel.org 1799L: linux-scsi@vger.kernel.org
1800S: Odd fixes (e.g., new signatures) 1800S: Odd Fixes (e.g., new signatures)
1801 1801
1802GDT SCSI DISK ARRAY CONTROLLER DRIVER 1802GDT SCSI DISK ARRAY CONTROLLER DRIVER
1803P: Achim Leubner 1803P: Achim Leubner
@@ -1838,10 +1838,10 @@ S: Maintained
1838HARDWARE MONITORING 1838HARDWARE MONITORING
1839L: lm-sensors@lm-sensors.org 1839L: lm-sensors@lm-sensors.org
1840W: http://www.lm-sensors.org/ 1840W: http://www.lm-sensors.org/
1841S: Orphaned 1841S: Orphan
1842 1842
1843HARDWARE RANDOM NUMBER GENERATOR CORE 1843HARDWARE RANDOM NUMBER GENERATOR CORE
1844S: Orphaned 1844S: Orphan
1845 1845
1846HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER 1846HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
1847P: Robert Love 1847P: Robert Love
@@ -2108,7 +2108,7 @@ M: rolandd@cisco.com
2108P: Sean Hefty 2108P: Sean Hefty
2109M: sean.hefty@intel.com 2109M: sean.hefty@intel.com
2110P: Hal Rosenstock 2110P: Hal Rosenstock
2111M: hal.rosenstock@gmail.com 2111M: hal.rosenstock@gmail.com
2112L: general@lists.openfabrics.org 2112L: general@lists.openfabrics.org
2113W: http://www.openib.org/ 2113W: http://www.openib.org/
2114T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git 2114T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
@@ -2696,17 +2696,17 @@ S: Maintained
2696 2696
2697MARVELL YUKON / SYSKONNECT DRIVER 2697MARVELL YUKON / SYSKONNECT DRIVER
2698P: Mirko Lindner 2698P: Mirko Lindner
2699M: mlindner@syskonnect.de 2699M: mlindner@syskonnect.de
2700P: Ralph Roesler 2700P: Ralph Roesler
2701M: rroesler@syskonnect.de 2701M: rroesler@syskonnect.de
2702W: http://www.syskonnect.com 2702W: http://www.syskonnect.com
2703S: Supported 2703S: Supported
2704 2704
2705MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 2705MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
2706P: Michael Kerrisk 2706P: Michael Kerrisk
2707M: mtk.manpages@gmail.com 2707M: mtk.manpages@gmail.com
2708W: http://www.kernel.org/doc/man-pages 2708W: http://www.kernel.org/doc/man-pages
2709S: Supported 2709S: Supported
2710 2710
2711MARVELL LIBERTAS WIRELESS DRIVER 2711MARVELL LIBERTAS WIRELESS DRIVER
2712P: Dan Williams 2712P: Dan Williams
@@ -2735,7 +2735,7 @@ S: Maintained
2735MEGARAID SCSI DRIVERS 2735MEGARAID SCSI DRIVERS
2736P: Neela Syam Kolli 2736P: Neela Syam Kolli
2737M: megaraidlinux@lsi.com 2737M: megaraidlinux@lsi.com
2738S: linux-scsi@vger.kernel.org 2738L: linux-scsi@vger.kernel.org
2739W: http://megaraid.lsilogic.com 2739W: http://megaraid.lsilogic.com
2740S: Maintained 2740S: Maintained
2741 2741
@@ -2853,7 +2853,7 @@ MULTIMEDIA CARD (MMC) ETC. OVER SPI
2853P: David Brownell 2853P: David Brownell
2854M: dbrownell@users.sourceforge.net 2854M: dbrownell@users.sourceforge.net
2855L: linux-kernel@vger.kernel.org 2855L: linux-kernel@vger.kernel.org
2856S: Odd fixes 2856S: Odd Fixes
2857 2857
2858MULTISOUND SOUND DRIVER 2858MULTISOUND SOUND DRIVER
2859P: Andrew Veliath 2859P: Andrew Veliath
@@ -2867,10 +2867,10 @@ L: linux-kernel@vger.kernel.org
2867S: Maintained 2867S: Maintained
2868 2868
2869MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER 2869MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
2870P: Felipe Balbi 2870P: Felipe Balbi
2871M: felipe.balbi@nokia.com 2871M: felipe.balbi@nokia.com
2872L: linux-usb@vger.kernel.org 2872L: linux-usb@vger.kernel.org
2873S: Maintained 2873S: Maintained
2874 2874
2875MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) 2875MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
2876P: Andrew Gallatin 2876P: Andrew Gallatin
@@ -2882,7 +2882,7 @@ W: http://www.myri.com/scs/download-Myri10GE.html
2882S: Supported 2882S: Supported
2883 2883
2884NATSEMI ETHERNET DRIVER (DP8381x) 2884NATSEMI ETHERNET DRIVER (DP8381x)
2885P: Tim Hockin 2885P: Tim Hockin
2886M: thockin@hockin.org 2886M: thockin@hockin.org
2887S: Maintained 2887S: Maintained
2888 2888
@@ -3101,7 +3101,7 @@ M: laforge@gnumonks.org
3101S: Maintained 3101S: Maintained
3102 3102
3103OMNIVISION OV7670 SENSOR DRIVER 3103OMNIVISION OV7670 SENSOR DRIVER
3104P: Jonathan Corbet 3104P: Jonathan Corbet
3105M: corbet@lwn.net 3105M: corbet@lwn.net
3106L: video4linux-list@redhat.com 3106L: video4linux-list@redhat.com
3107S: Maintained 3107S: Maintained
@@ -3211,7 +3211,7 @@ T: git kernel.org:/pub/scm/linux/kernel/git/jbarnes/pci-2.6.git
3211S: Supported 3211S: Supported
3212 3212
3213PCI HOTPLUG CORE 3213PCI HOTPLUG CORE
3214P: Kristen Carlson Accardi 3214P: Kristen Carlson Accardi
3215M: kristen.c.accardi@intel.com 3215M: kristen.c.accardi@intel.com
3216S: Supported 3216S: Supported
3217 3217
@@ -3650,7 +3650,7 @@ M: jmorris@namei.org
3650P: Eric Paris 3650P: Eric Paris
3651M: eparis@parisplace.org 3651M: eparis@parisplace.org
3652L: linux-kernel@vger.kernel.org (kernel issues) 3652L: linux-kernel@vger.kernel.org (kernel issues)
3653L: selinux@tycho.nsa.gov (subscribers-only, general discussion) 3653L: selinux@tycho.nsa.gov (subscribers-only, general discussion)
3654W: http://www.nsa.gov/selinux 3654W: http://www.nsa.gov/selinux
3655S: Supported 3655S: Supported
3656 3656
@@ -3768,10 +3768,10 @@ M: bn@niasdigital.com
3768S: Maintained 3768S: Maintained
3769 3769
3770SOC-CAMERA V4L2 SUBSYSTEM 3770SOC-CAMERA V4L2 SUBSYSTEM
3771P: Guennadi Liakhovetski 3771P: Guennadi Liakhovetski
3772M: g.liakhovetski@gmx.de 3772M: g.liakhovetski@gmx.de
3773L: video4linux-list@redhat.com 3773L: video4linux-list@redhat.com
3774S: Maintained 3774S: Maintained
3775 3775
3776SOFTWARE RAID (Multiple Disks) SUPPORT 3776SOFTWARE RAID (Multiple Disks) SUPPORT
3777P: Ingo Molnar 3777P: Ingo Molnar
@@ -3925,7 +3925,7 @@ S: Maintained
3925 3925
3926STARMODE RADIO IP (STRIP) PROTOCOL DRIVER 3926STARMODE RADIO IP (STRIP) PROTOCOL DRIVER
3927W: http://mosquitonet.Stanford.EDU/strip.html 3927W: http://mosquitonet.Stanford.EDU/strip.html
3928S: Unsupported ? 3928S: Orphan
3929 3929
3930STRADIS MPEG-2 DECODER DRIVER 3930STRADIS MPEG-2 DECODER DRIVER
3931P: Nathan Laredo 3931P: Nathan Laredo
@@ -4006,9 +4006,9 @@ T: git repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
4006S: Maintained 4006S: Maintained
4007 4007
4008TI FLASH MEDIA INTERFACE DRIVER 4008TI FLASH MEDIA INTERFACE DRIVER
4009P: Alex Dubov 4009P: Alex Dubov
4010M: oakad@yahoo.com 4010M: oakad@yahoo.com
4011S: Maintained 4011S: Maintained
4012 4012
4013TI OMAP MMC INTERFACE DRIVER 4013TI OMAP MMC INTERFACE DRIVER
4014P: Carlos Aguiar, Anderson Briglia and Syed Khasim 4014P: Carlos Aguiar, Anderson Briglia and Syed Khasim
@@ -4154,13 +4154,13 @@ USB BLOCK DRIVER (UB ub)
4154P: Pete Zaitcev 4154P: Pete Zaitcev
4155M: zaitcev@redhat.com 4155M: zaitcev@redhat.com
4156L: linux-kernel@vger.kernel.org 4156L: linux-kernel@vger.kernel.org
4157L: linux-usb@vger.kernel.org 4157L: linux-usb@vger.kernel.org
4158S: Supported 4158S: Supported
4159 4159
4160USB CDC ETHERNET DRIVER 4160USB CDC ETHERNET DRIVER
4161P: Greg Kroah-Hartman 4161P: Greg Kroah-Hartman
4162M: greg@kroah.com 4162M: greg@kroah.com
4163L: linux-usb@vger.kernel.org 4163L: linux-usb@vger.kernel.org
4164S: Maintained 4164S: Maintained
4165W: http://www.kroah.com/linux-usb/ 4165W: http://www.kroah.com/linux-usb/
4166 4166
@@ -4187,13 +4187,13 @@ S: Maintained
4187USB EHCI DRIVER 4187USB EHCI DRIVER
4188P: David Brownell 4188P: David Brownell
4189M: dbrownell@users.sourceforge.net 4189M: dbrownell@users.sourceforge.net
4190L: linux-usb@vger.kernel.org 4190L: linux-usb@vger.kernel.org
4191S: Odd Fixes 4191S: Odd Fixes
4192 4192
4193USB ET61X[12]51 DRIVER 4193USB ET61X[12]51 DRIVER
4194P: Luca Risolia 4194P: Luca Risolia
4195M: luca.risolia@studio.unibo.it 4195M: luca.risolia@studio.unibo.it
4196L: linux-usb@vger.kernel.org 4196L: linux-usb@vger.kernel.org
4197L: video4linux-list@redhat.com 4197L: video4linux-list@redhat.com
4198W: http://www.linux-projects.org 4198W: http://www.linux-projects.org
4199S: Maintained 4199S: Maintained
@@ -4201,33 +4201,33 @@ S: Maintained
4201USB GADGET/PERIPHERAL SUBSYSTEM 4201USB GADGET/PERIPHERAL SUBSYSTEM
4202P: David Brownell 4202P: David Brownell
4203M: dbrownell@users.sourceforge.net 4203M: dbrownell@users.sourceforge.net
4204L: linux-usb@vger.kernel.org 4204L: linux-usb@vger.kernel.org
4205W: http://www.linux-usb.org/gadget 4205W: http://www.linux-usb.org/gadget
4206S: Maintained 4206S: Maintained
4207 4207
4208USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 4208USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
4209P: Jiri Kosina 4209P: Jiri Kosina
4210M: jkosina@suse.cz 4210M: jkosina@suse.cz
4211L: linux-usb@vger.kernel.org 4211L: linux-usb@vger.kernel.org
4212T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 4212T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
4213S: Maintained 4213S: Maintained
4214 4214
4215USB ISP116X DRIVER 4215USB ISP116X DRIVER
4216P: Olav Kongas 4216P: Olav Kongas
4217M: ok@artecdesign.ee 4217M: ok@artecdesign.ee
4218L: linux-usb@vger.kernel.org 4218L: linux-usb@vger.kernel.org
4219S: Maintained 4219S: Maintained
4220 4220
4221USB KAWASAKI LSI DRIVER 4221USB KAWASAKI LSI DRIVER
4222P: Oliver Neukum 4222P: Oliver Neukum
4223M: oliver@neukum.name 4223M: oliver@neukum.name
4224L: linux-usb@vger.kernel.org 4224L: linux-usb@vger.kernel.org
4225S: Maintained 4225S: Maintained
4226 4226
4227USB MASS STORAGE DRIVER 4227USB MASS STORAGE DRIVER
4228P: Matthew Dharm 4228P: Matthew Dharm
4229M: mdharm-usb@one-eyed-alien.net 4229M: mdharm-usb@one-eyed-alien.net
4230L: linux-usb@vger.kernel.org 4230L: linux-usb@vger.kernel.org
4231L: usb-storage@lists.one-eyed-alien.net 4231L: usb-storage@lists.one-eyed-alien.net
4232S: Maintained 4232S: Maintained
4233W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ 4233W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
@@ -4235,26 +4235,26 @@ W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
4235USB OHCI DRIVER 4235USB OHCI DRIVER
4236P: David Brownell 4236P: David Brownell
4237M: dbrownell@users.sourceforge.net 4237M: dbrownell@users.sourceforge.net
4238L: linux-usb@vger.kernel.org 4238L: linux-usb@vger.kernel.org
4239S: Odd Fixes 4239S: Odd Fixes
4240 4240
4241USB OPTION-CARD DRIVER 4241USB OPTION-CARD DRIVER
4242P: Matthias Urlichs 4242P: Matthias Urlichs
4243M: smurf@smurf.noris.de 4243M: smurf@smurf.noris.de
4244L: linux-usb@vger.kernel.org 4244L: linux-usb@vger.kernel.org
4245S: Maintained 4245S: Maintained
4246 4246
4247USB OV511 DRIVER 4247USB OV511 DRIVER
4248P: Mark McClelland 4248P: Mark McClelland
4249M: mmcclell@bigfoot.com 4249M: mmcclell@bigfoot.com
4250L: linux-usb@vger.kernel.org 4250L: linux-usb@vger.kernel.org
4251W: http://alpha.dyndns.org/ov511/ 4251W: http://alpha.dyndns.org/ov511/
4252S: Maintained 4252S: Maintained
4253 4253
4254USB PEGASUS DRIVER 4254USB PEGASUS DRIVER
4255P: Petko Manolov 4255P: Petko Manolov
4256M: petkan@users.sourceforge.net 4256M: petkan@users.sourceforge.net
4257L: linux-usb@vger.kernel.org 4257L: linux-usb@vger.kernel.org
4258L: netdev@vger.kernel.org 4258L: netdev@vger.kernel.org
4259W: http://pegasus2.sourceforge.net/ 4259W: http://pegasus2.sourceforge.net/
4260S: Maintained 4260S: Maintained
@@ -4262,13 +4262,13 @@ S: Maintained
4262USB PRINTER DRIVER (usblp) 4262USB PRINTER DRIVER (usblp)
4263P: Pete Zaitcev 4263P: Pete Zaitcev
4264M: zaitcev@redhat.com 4264M: zaitcev@redhat.com
4265L: linux-usb@vger.kernel.org 4265L: linux-usb@vger.kernel.org
4266S: Supported 4266S: Supported
4267 4267
4268USB RTL8150 DRIVER 4268USB RTL8150 DRIVER
4269P: Petko Manolov 4269P: Petko Manolov
4270M: petkan@users.sourceforge.net 4270M: petkan@users.sourceforge.net
4271L: linux-usb@vger.kernel.org 4271L: linux-usb@vger.kernel.org
4272L: netdev@vger.kernel.org 4272L: netdev@vger.kernel.org
4273W: http://pegasus2.sourceforge.net/ 4273W: http://pegasus2.sourceforge.net/
4274S: Maintained 4274S: Maintained
@@ -4276,20 +4276,20 @@ S: Maintained
4276USB SE401 DRIVER 4276USB SE401 DRIVER
4277P: Jeroen Vreeken 4277P: Jeroen Vreeken
4278M: pe1rxq@amsat.org 4278M: pe1rxq@amsat.org
4279L: linux-usb@vger.kernel.org 4279L: linux-usb@vger.kernel.org
4280W: http://www.chello.nl/~j.vreeken/se401/ 4280W: http://www.chello.nl/~j.vreeken/se401/
4281S: Maintained 4281S: Maintained
4282 4282
4283USB SERIAL BELKIN F5U103 DRIVER 4283USB SERIAL BELKIN F5U103 DRIVER
4284P: William Greathouse 4284P: William Greathouse
4285M: wgreathouse@smva.com 4285M: wgreathouse@smva.com
4286L: linux-usb@vger.kernel.org 4286L: linux-usb@vger.kernel.org
4287S: Maintained 4287S: Maintained
4288 4288
4289USB SERIAL CYPRESS M8 DRIVER 4289USB SERIAL CYPRESS M8 DRIVER
4290P: Lonnie Mendez 4290P: Lonnie Mendez
4291M: dignome@gmail.com 4291M: dignome@gmail.com
4292L: linux-usb@vger.kernel.org 4292L: linux-usb@vger.kernel.org
4293S: Maintained 4293S: Maintained
4294W: http://geocities.com/i0xox0i 4294W: http://geocities.com/i0xox0i
4295W: http://firstlight.net/cvs 4295W: http://firstlight.net/cvs
@@ -4304,39 +4304,39 @@ USB SERIAL DIGI ACCELEPORT DRIVER
4304P: Peter Berger and Al Borchers 4304P: Peter Berger and Al Borchers
4305M: pberger@brimson.com 4305M: pberger@brimson.com
4306M: alborchers@steinerpoint.com 4306M: alborchers@steinerpoint.com
4307L: linux-usb@vger.kernel.org 4307L: linux-usb@vger.kernel.org
4308S: Maintained 4308S: Maintained
4309 4309
4310USB SERIAL DRIVER 4310USB SERIAL DRIVER
4311P: Greg Kroah-Hartman 4311P: Greg Kroah-Hartman
4312M: gregkh@suse.de 4312M: gregkh@suse.de
4313L: linux-usb@vger.kernel.org 4313L: linux-usb@vger.kernel.org
4314S: Supported 4314S: Supported
4315 4315
4316USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER 4316USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
4317P: Gary Brubaker 4317P: Gary Brubaker
4318M: xavyer@ix.netcom.com 4318M: xavyer@ix.netcom.com
4319L: linux-usb@vger.kernel.org 4319L: linux-usb@vger.kernel.org
4320S: Maintained 4320S: Maintained
4321 4321
4322USB SERIAL KEYSPAN DRIVER 4322USB SERIAL KEYSPAN DRIVER
4323P: Greg Kroah-Hartman 4323P: Greg Kroah-Hartman
4324M: greg@kroah.com 4324M: greg@kroah.com
4325L: linux-usb@vger.kernel.org 4325L: linux-usb@vger.kernel.org
4326W: http://www.kroah.com/linux/ 4326W: http://www.kroah.com/linux/
4327S: Maintained 4327S: Maintained
4328 4328
4329USB SERIAL WHITEHEAT DRIVER 4329USB SERIAL WHITEHEAT DRIVER
4330P: Support Department 4330P: Support Department
4331M: support@connecttech.com 4331M: support@connecttech.com
4332L: linux-usb@vger.kernel.org 4332L: linux-usb@vger.kernel.org
4333W: http://www.connecttech.com 4333W: http://www.connecttech.com
4334S: Supported 4334S: Supported
4335 4335
4336USB SN9C1xx DRIVER 4336USB SN9C1xx DRIVER
4337P: Luca Risolia 4337P: Luca Risolia
4338M: luca.risolia@studio.unibo.it 4338M: luca.risolia@studio.unibo.it
4339L: linux-usb@vger.kernel.org 4339L: linux-usb@vger.kernel.org
4340L: video4linux-list@redhat.com 4340L: video4linux-list@redhat.com
4341W: http://www.linux-projects.org 4341W: http://www.linux-projects.org
4342S: Maintained 4342S: Maintained
@@ -4344,7 +4344,7 @@ S: Maintained
4344USB SUBSYSTEM 4344USB SUBSYSTEM
4345P: Greg Kroah-Hartman 4345P: Greg Kroah-Hartman
4346M: gregkh@suse.de 4346M: gregkh@suse.de
4347L: linux-usb@vger.kernel.org 4347L: linux-usb@vger.kernel.org
4348W: http://www.linux-usb.org 4348W: http://www.linux-usb.org
4349T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 4349T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
4350S: Supported 4350S: Supported
@@ -4352,7 +4352,7 @@ S: Supported
4352USB UHCI DRIVER 4352USB UHCI DRIVER
4353P: Alan Stern 4353P: Alan Stern
4354M: stern@rowland.harvard.edu 4354M: stern@rowland.harvard.edu
4355L: linux-usb@vger.kernel.org 4355L: linux-usb@vger.kernel.org
4356S: Maintained 4356S: Maintained
4357 4357
4358USB "USBNET" DRIVER FRAMEWORK 4358USB "USBNET" DRIVER FRAMEWORK
@@ -4373,7 +4373,7 @@ S: Maintained
4373USB W996[87]CF DRIVER 4373USB W996[87]CF DRIVER
4374P: Luca Risolia 4374P: Luca Risolia
4375M: luca.risolia@studio.unibo.it 4375M: luca.risolia@studio.unibo.it
4376L: linux-usb@vger.kernel.org 4376L: linux-usb@vger.kernel.org
4377L: video4linux-list@redhat.com 4377L: video4linux-list@redhat.com
4378W: http://www.linux-projects.org 4378W: http://www.linux-projects.org
4379S: Maintained 4379S: Maintained
@@ -4387,7 +4387,7 @@ S: Maintained
4387USB ZC0301 DRIVER 4387USB ZC0301 DRIVER
4388P: Luca Risolia 4388P: Luca Risolia
4389M: luca.risolia@studio.unibo.it 4389M: luca.risolia@studio.unibo.it
4390L: linux-usb@vger.kernel.org 4390L: linux-usb@vger.kernel.org
4391L: video4linux-list@redhat.com 4391L: video4linux-list@redhat.com
4392W: http://www.linux-projects.org 4392W: http://www.linux-projects.org
4393S: Maintained 4393S: Maintained
@@ -4395,14 +4395,14 @@ S: Maintained
4395USB ZD1201 DRIVER 4395USB ZD1201 DRIVER
4396P: Jeroen Vreeken 4396P: Jeroen Vreeken
4397M: pe1rxq@amsat.org 4397M: pe1rxq@amsat.org
4398L: linux-usb@vger.kernel.org 4398L: linux-usb@vger.kernel.org
4399W: http://linux-lc100020.sourceforge.net 4399W: http://linux-lc100020.sourceforge.net
4400S: Maintained 4400S: Maintained
4401 4401
4402USB ZR364XX DRIVER 4402USB ZR364XX DRIVER
4403P: Antoine Jacquet 4403P: Antoine Jacquet
4404M: royale@zerezo.com 4404M: royale@zerezo.com
4405L: linux-usb@vger.kernel.org 4405L: linux-usb@vger.kernel.org
4406L: video4linux-list@redhat.com 4406L: video4linux-list@redhat.com
4407W: http://royale.zerezo.com/zr364xx/ 4407W: http://royale.zerezo.com/zr364xx/
4408S: Maintained 4408S: Maintained
diff --git a/Makefile b/Makefile
index 4ff83ea36c19..cab896a97296 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 27 3SUBLEVEL = 27
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 720c48b9ee04..aa2fc375a325 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -70,9 +70,6 @@ void davinci_psc_config(unsigned int domain, unsigned int id, char enable)
70{ 70{
71 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask; 71 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask;
72 72
73 if (id < 0)
74 return;
75
76 mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id); 73 mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id);
77 if (enable) 74 if (enable)
78 mdctl |= 0x00000003; /* Enable Module */ 75 mdctl |= 0x00000003; /* Enable Module */
diff --git a/arch/arm/mach-sa1100/include/mach/jornada720.h b/arch/arm/mach-sa1100/include/mach/jornada720.h
index bc120850d313..cc6b4bfcecf6 100644
--- a/arch/arm/mach-sa1100/include/mach/jornada720.h
+++ b/arch/arm/mach-sa1100/include/mach/jornada720.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * arch/arm/mach-sa1100/include/mach/jornada720.h 2 * arch/arm/mach-sa1100/include/mach/jornada720.h
3 * 3 *
4 * This file contains SSP/MCU communication definitions for HP Jornada 710/720/728 4 * SSP/MCU communication definitions for HP Jornada 710/720/728
5 * 5 *
6 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com> 6 * Copyright 2007,2008 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
7 * Copyright (C) 2000 John Ankcorn <jca@lcs.mit.edu> 7 * Copyright 2000 John Ankcorn <jca@lcs.mit.edu>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -25,3 +25,8 @@
25#define PWMOFF 0xDF 25#define PWMOFF 0xDF
26#define TXDUMMY 0x11 26#define TXDUMMY 0x11
27#define ERRORCODE 0x00 27#define ERRORCODE 0x00
28
29extern void jornada_ssp_start(void);
30extern void jornada_ssp_end(void);
31extern int jornada_ssp_inout(u8 byte);
32extern int jornada_ssp_byte(u8 byte);
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 06ea7abd9170..28cf36967977 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -21,8 +21,8 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/ssp.h>
25#include <mach/jornada720.h> 24#include <mach/jornada720.h>
25#include <asm/hardware/ssp.h>
26 26
27static DEFINE_SPINLOCK(jornada_ssp_lock); 27static DEFINE_SPINLOCK(jornada_ssp_lock);
28static unsigned long jornada_ssp_flags; 28static unsigned long jornada_ssp_flags;
@@ -109,12 +109,12 @@ EXPORT_SYMBOL(jornada_ssp_inout);
109 * jornada_ssp_start - enable mcu 109 * jornada_ssp_start - enable mcu
110 * 110 *
111 */ 111 */
112int jornada_ssp_start() 112void jornada_ssp_start(void)
113{ 113{
114 spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags); 114 spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags);
115 GPCR = GPIO_GPIO25; 115 GPCR = GPIO_GPIO25;
116 udelay(50); 116 udelay(50);
117 return 0; 117 return;
118}; 118};
119EXPORT_SYMBOL(jornada_ssp_start); 119EXPORT_SYMBOL(jornada_ssp_start);
120 120
@@ -122,11 +122,11 @@ EXPORT_SYMBOL(jornada_ssp_start);
122 * jornada_ssp_end - disable mcu and turn off lock 122 * jornada_ssp_end - disable mcu and turn off lock
123 * 123 *
124 */ 124 */
125int jornada_ssp_end() 125void jornada_ssp_end(void)
126{ 126{
127 GPSR = GPIO_GPIO25; 127 GPSR = GPIO_GPIO25;
128 spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags); 128 spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags);
129 return 0; 129 return;
130}; 130};
131EXPORT_SYMBOL(jornada_ssp_end); 131EXPORT_SYMBOL(jornada_ssp_end);
132 132
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index bc1cf30c83e0..01da719a7453 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -316,19 +316,6 @@ static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
316 omap_cfg_reg(MMC_DAT3); 316 omap_cfg_reg(MMC_DAT3);
317 } 317 }
318 } 318 }
319#if defined(CONFIG_ARCH_OMAP2420)
320 if (mmc_conf->mmc[0].internal_clock) {
321 /*
322 * Use internal loop-back in MMC/SDIO
323 * Module Input Clock selection
324 */
325 if (cpu_is_omap24xx()) {
326 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
327 v |= (1 << 24); /* not used in 243x */
328 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
329 }
330 }
331#endif
332 } 319 }
333 320
334#ifdef CONFIG_ARCH_OMAP16XX 321#ifdef CONFIG_ARCH_OMAP16XX
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index ee4c292683e1..dfc3443e23aa 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -325,7 +325,7 @@ static int __init atstk1002_init(void)
325#ifdef CONFIG_BOARD_ATSTK100X_SPI1 325#ifdef CONFIG_BOARD_ATSTK100X_SPI1
326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
327#endif 327#endif
328#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 328#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
329 at32_add_device_mci(0, MCI_PDATA); 329 at32_add_device_mci(0, MCI_PDATA);
330#endif 330#endif
331#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM 331#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
diff --git a/arch/avr32/boot/images/.gitignore b/arch/avr32/boot/images/.gitignore
new file mode 100644
index 000000000000..64ea9d0141d2
--- /dev/null
+++ b/arch/avr32/boot/images/.gitignore
@@ -0,0 +1,4 @@
1uImage
2uImage.srec
3vmlinux.cso
4sfdwarf.log
diff --git a/arch/avr32/kernel/.gitignore b/arch/avr32/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/avr32/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c
index 84a7d44edc67..11e310c567a9 100644
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -58,6 +58,7 @@ EXPORT_SYMBOL(find_first_zero_bit);
58EXPORT_SYMBOL(find_next_zero_bit); 58EXPORT_SYMBOL(find_next_zero_bit);
59EXPORT_SYMBOL(find_first_bit); 59EXPORT_SYMBOL(find_first_bit);
60EXPORT_SYMBOL(find_next_bit); 60EXPORT_SYMBOL(find_next_bit);
61EXPORT_SYMBOL(generic_find_next_le_bit);
61EXPORT_SYMBOL(generic_find_next_zero_le_bit); 62EXPORT_SYMBOL(generic_find_next_zero_le_bit);
62 63
63/* I/O primitives (lib/io-*.S) */ 64/* I/O primitives (lib/io-*.S) */
diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
index 890286a1e62b..673178e235f3 100644
--- a/arch/avr32/kernel/syscall-stubs.S
+++ b/arch/avr32/kernel/syscall-stubs.S
@@ -109,3 +109,12 @@ __sys_epoll_pwait:
109 rcall sys_epoll_pwait 109 rcall sys_epoll_pwait
110 sub sp, -4 110 sub sp, -4
111 popm pc 111 popm pc
112
113 .global __sys_sync_file_range
114 .type __sys_sync_file_range,@function
115__sys_sync_file_range:
116 pushm lr
117 st.w --sp, ARG6
118 rcall sys_sync_file_range
119 sub sp, -4
120 popm pc
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index 478bda4c4a09..7ee0057613b3 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -275,7 +275,7 @@ sys_call_table:
275 .long sys_set_robust_list 275 .long sys_set_robust_list
276 .long sys_get_robust_list /* 260 */ 276 .long sys_get_robust_list /* 260 */
277 .long __sys_splice 277 .long __sys_splice
278 .long sys_sync_file_range 278 .long __sys_sync_file_range
279 .long sys_tee 279 .long sys_tee
280 .long sys_vmsplice 280 .long sys_vmsplice
281 .long __sys_epoll_pwait /* 265 */ 281 .long __sys_epoll_pwait /* 265 */
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index b835c4c01368..0d987373bc01 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -116,15 +116,15 @@ asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs)
116 switch (ret) { 116 switch (ret) {
117 case NOTIFY_OK: 117 case NOTIFY_OK:
118 case NOTIFY_STOP: 118 case NOTIFY_STOP:
119 return; 119 break;
120 case NOTIFY_BAD: 120 case NOTIFY_BAD:
121 die("Fatal Non-Maskable Interrupt", regs, SIGINT); 121 die("Fatal Non-Maskable Interrupt", regs, SIGINT);
122 default: 122 default:
123 printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
124 nmi_disable();
123 break; 125 break;
124 } 126 }
125 127 nmi_exit();
126 printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
127 nmi_disable();
128} 128}
129 129
130asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs) 130asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs)
diff --git a/arch/avr32/lib/findbit.S b/arch/avr32/lib/findbit.S
index c6b91dee857c..997b33b2288a 100644
--- a/arch/avr32/lib/findbit.S
+++ b/arch/avr32/lib/findbit.S
@@ -123,6 +123,36 @@ ENTRY(find_next_bit)
123 brgt 1b 123 brgt 1b
124 retal r11 124 retal r11
125 125
126ENTRY(generic_find_next_le_bit)
127 lsr r8, r10, 5
128 sub r9, r11, r10
129 retle r11
130
131 lsl r8, 2
132 add r12, r8
133 andl r10, 31, COH
134 breq 1f
135
136 /* offset is not word-aligned. Handle the first (32 - r10) bits */
137 ldswp.w r8, r12[0]
138 sub r12, -4
139 lsr r8, r8, r10
140 brne .L_found
141
142 /* r9 = r9 - (32 - r10) = r9 + r10 - 32 */
143 add r9, r10
144 sub r9, 32
145 retle r11
146
147 /* Main loop. offset must be word-aligned */
1481: ldswp.w r8, r12[0]
149 cp.w r8, 0
150 brne .L_found
151 sub r12, -4
152 sub r9, 32
153 brgt 1b
154 retal r11
155
126ENTRY(generic_find_next_zero_le_bit) 156ENTRY(generic_find_next_zero_le_bit)
127 lsr r8, r10, 5 157 lsr r8, r10, 5
128 sub r9, r11, r10 158 sub r9, r11, r10
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 7a37d06376be..cd0d1a7284b7 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -38,6 +38,7 @@
38#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
39#include <asm/div64.h> 39#include <asm/div64.h>
40#include <asm/tlb.h> 40#include <asm/tlb.h>
41#include <asm/elf.h>
41 42
42#include "misc.h" 43#include "misc.h"
43#include "vti.h" 44#include "vti.h"
@@ -61,12 +62,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
61 { NULL } 62 { NULL }
62}; 63};
63 64
64
65struct fdesc{
66 unsigned long ip;
67 unsigned long gp;
68};
69
70static void kvm_flush_icache(unsigned long start, unsigned long len) 65static void kvm_flush_icache(unsigned long start, unsigned long len)
71{ 66{
72 int l; 67 int l;
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 335a6ae3d594..11c92dc53791 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -45,18 +45,7 @@ static void r39xx_wait(void)
45 local_irq_enable(); 45 local_irq_enable();
46} 46}
47 47
48/* 48extern void r4k_wait(void);
49 * There is a race when WAIT instruction executed with interrupt
50 * enabled.
51 * But it is implementation-dependent wheter the pipelie restarts when
52 * a non-enabled interrupt is requested.
53 */
54static void r4k_wait(void)
55{
56 __asm__(" .set mips3 \n"
57 " wait \n"
58 " .set mips0 \n");
59}
60 49
61/* 50/*
62 * This variant is preferable as it allows testing need_resched and going to 51 * This variant is preferable as it allows testing need_resched and going to
@@ -128,7 +117,7 @@ static int __init wait_disable(char *s)
128 117
129__setup("nowait", wait_disable); 118__setup("nowait", wait_disable);
130 119
131static inline void check_wait(void) 120void __init check_wait(void)
132{ 121{
133 struct cpuinfo_mips *c = &current_cpu_data; 122 struct cpuinfo_mips *c = &current_cpu_data;
134 123
@@ -242,7 +231,6 @@ static inline void check_errata(void)
242 231
243void __init check_bugs32(void) 232void __init check_bugs32(void)
244{ 233{
245 check_wait();
246 check_errata(); 234 check_errata();
247} 235}
248 236
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index c6ada98ee042..f886dd7f708e 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -20,6 +20,7 @@
20#include <asm/stackframe.h> 20#include <asm/stackframe.h>
21#include <asm/war.h> 21#include <asm/war.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/thread_info.h>
23 24
24#define PANIC_PIC(msg) \ 25#define PANIC_PIC(msg) \
25 .set push; \ 26 .set push; \
@@ -126,7 +127,42 @@ handle_vcei:
126 127
127 __FINIT 128 __FINIT
128 129
130 .align 5 /* 32 byte rollback region */
131LEAF(r4k_wait)
132 .set push
133 .set noreorder
134 /* start of rollback region */
135 LONG_L t0, TI_FLAGS($28)
136 nop
137 andi t0, _TIF_NEED_RESCHED
138 bnez t0, 1f
139 nop
140 nop
141 nop
142 .set mips3
143 wait
144 /* end of rollback region (the region size must be power of two) */
145 .set pop
1461:
147 jr ra
148 END(r4k_wait)
149
150 .macro BUILD_ROLLBACK_PROLOGUE handler
151 FEXPORT(rollback_\handler)
152 .set push
153 .set noat
154 MFC0 k0, CP0_EPC
155 PTR_LA k1, r4k_wait
156 ori k0, 0x1f /* 32 byte rollback region */
157 xori k0, 0x1f
158 bne k0, k1, 9f
159 MTC0 k0, CP0_EPC
1609:
161 .set pop
162 .endm
163
129 .align 5 164 .align 5
165BUILD_ROLLBACK_PROLOGUE handle_int
130NESTED(handle_int, PT_SIZE, sp) 166NESTED(handle_int, PT_SIZE, sp)
131#ifdef CONFIG_TRACE_IRQFLAGS 167#ifdef CONFIG_TRACE_IRQFLAGS
132 /* 168 /*
@@ -201,6 +237,7 @@ NESTED(except_vec_ejtag_debug, 0, sp)
201 * This prototype is copied to ebase + n*IntCtl.VS and patched 237 * This prototype is copied to ebase + n*IntCtl.VS and patched
202 * to invoke the handler 238 * to invoke the handler
203 */ 239 */
240BUILD_ROLLBACK_PROLOGUE except_vec_vi
204NESTED(except_vec_vi, 0, sp) 241NESTED(except_vec_vi, 0, sp)
205 SAVE_SOME 242 SAVE_SOME
206 SAVE_AT 243 SAVE_AT
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index b16facd9ea8e..ce7684335a41 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -148,6 +148,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
148 clear_tsk_thread_flag(p, TIF_USEDFPU); 148 clear_tsk_thread_flag(p, TIF_USEDFPU);
149 149
150#ifdef CONFIG_MIPS_MT_FPAFF 150#ifdef CONFIG_MIPS_MT_FPAFF
151 clear_tsk_thread_flag(p, TIF_FPUBOUND);
152
151 /* 153 /*
152 * FPU affinity support is cleaner if we track the 154 * FPU affinity support is cleaner if we track the
153 * user-visible CPU affinity from the very beginning. 155 * user-visible CPU affinity from the very beginning.
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 6bee29097a56..5fd0cd020af5 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -46,6 +46,9 @@
46#include <asm/types.h> 46#include <asm/types.h>
47#include <asm/stacktrace.h> 47#include <asm/stacktrace.h>
48 48
49extern void check_wait(void);
50extern asmlinkage void r4k_wait(void);
51extern asmlinkage void rollback_handle_int(void);
49extern asmlinkage void handle_int(void); 52extern asmlinkage void handle_int(void);
50extern asmlinkage void handle_tlbm(void); 53extern asmlinkage void handle_tlbm(void);
51extern asmlinkage void handle_tlbl(void); 54extern asmlinkage void handle_tlbl(void);
@@ -1251,6 +1254,9 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1251 1254
1252 extern char except_vec_vi, except_vec_vi_lui; 1255 extern char except_vec_vi, except_vec_vi_lui;
1253 extern char except_vec_vi_ori, except_vec_vi_end; 1256 extern char except_vec_vi_ori, except_vec_vi_end;
1257 extern char rollback_except_vec_vi;
1258 char *vec_start = (cpu_wait == r4k_wait) ?
1259 &rollback_except_vec_vi : &except_vec_vi;
1254#ifdef CONFIG_MIPS_MT_SMTC 1260#ifdef CONFIG_MIPS_MT_SMTC
1255 /* 1261 /*
1256 * We need to provide the SMTC vectored interrupt handler 1262 * We need to provide the SMTC vectored interrupt handler
@@ -1258,11 +1264,11 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1258 * Status.IM bit to be masked before going there. 1264 * Status.IM bit to be masked before going there.
1259 */ 1265 */
1260 extern char except_vec_vi_mori; 1266 extern char except_vec_vi_mori;
1261 const int mori_offset = &except_vec_vi_mori - &except_vec_vi; 1267 const int mori_offset = &except_vec_vi_mori - vec_start;
1262#endif /* CONFIG_MIPS_MT_SMTC */ 1268#endif /* CONFIG_MIPS_MT_SMTC */
1263 const int handler_len = &except_vec_vi_end - &except_vec_vi; 1269 const int handler_len = &except_vec_vi_end - vec_start;
1264 const int lui_offset = &except_vec_vi_lui - &except_vec_vi; 1270 const int lui_offset = &except_vec_vi_lui - vec_start;
1265 const int ori_offset = &except_vec_vi_ori - &except_vec_vi; 1271 const int ori_offset = &except_vec_vi_ori - vec_start;
1266 1272
1267 if (handler_len > VECTORSPACING) { 1273 if (handler_len > VECTORSPACING) {
1268 /* 1274 /*
@@ -1272,7 +1278,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1272 panic("VECTORSPACING too small"); 1278 panic("VECTORSPACING too small");
1273 } 1279 }
1274 1280
1275 memcpy(b, &except_vec_vi, handler_len); 1281 memcpy(b, vec_start, handler_len);
1276#ifdef CONFIG_MIPS_MT_SMTC 1282#ifdef CONFIG_MIPS_MT_SMTC
1277 BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */ 1283 BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */
1278 1284
@@ -1554,6 +1560,10 @@ void __init trap_init(void)
1554 extern char except_vec3_generic, except_vec3_r4000; 1560 extern char except_vec3_generic, except_vec3_r4000;
1555 extern char except_vec4; 1561 extern char except_vec4;
1556 unsigned long i; 1562 unsigned long i;
1563 int rollback;
1564
1565 check_wait();
1566 rollback = (cpu_wait == r4k_wait);
1557 1567
1558#if defined(CONFIG_KGDB) 1568#if defined(CONFIG_KGDB)
1559 if (kgdb_early_setup) 1569 if (kgdb_early_setup)
@@ -1618,7 +1628,7 @@ void __init trap_init(void)
1618 if (board_be_init) 1628 if (board_be_init)
1619 board_be_init(); 1629 board_be_init();
1620 1630
1621 set_except_vector(0, handle_int); 1631 set_except_vector(0, rollback ? rollback_handle_int : handle_int);
1622 set_except_vector(1, handle_tlbm); 1632 set_except_vector(1, handle_tlbm);
1623 set_except_vector(2, handle_tlbl); 1633 set_except_vector(2, handle_tlbl);
1624 set_except_vector(3, handle_tlbs); 1634 set_except_vector(3, handle_tlbs);
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index b5470ceb418b..afb119f35682 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -36,6 +36,7 @@ SECTIONS
36 SCHED_TEXT 36 SCHED_TEXT
37 LOCK_TEXT 37 LOCK_TEXT
38 KPROBES_TEXT 38 KPROBES_TEXT
39 *(.text.*)
39 *(.fixup) 40 *(.fixup)
40 *(.gnu.warning) 41 *(.gnu.warning)
41 } :text = 0 42 } :text = 0
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 8d7784122c14..edac9892c51a 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -39,12 +39,14 @@
39#ifdef USE_DOUBLE 39#ifdef USE_DOUBLE
40 40
41#define LOAD ld 41#define LOAD ld
42#define LOAD32 lwu
42#define ADD daddu 43#define ADD daddu
43#define NBYTES 8 44#define NBYTES 8
44 45
45#else 46#else
46 47
47#define LOAD lw 48#define LOAD lw
49#define LOAD32 lw
48#define ADD addu 50#define ADD addu
49#define NBYTES 4 51#define NBYTES 4
50 52
@@ -60,6 +62,14 @@
60 ADD sum, v1; \ 62 ADD sum, v1; \
61 .set pop 63 .set pop
62 64
65#define ADDC32(sum,reg) \
66 .set push; \
67 .set noat; \
68 addu sum, reg; \
69 sltu v1, sum, reg; \
70 addu sum, v1; \
71 .set pop
72
63#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \ 73#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \
64 LOAD _t0, (offset + UNIT(0))(src); \ 74 LOAD _t0, (offset + UNIT(0))(src); \
65 LOAD _t1, (offset + UNIT(1))(src); \ 75 LOAD _t1, (offset + UNIT(1))(src); \
@@ -132,7 +142,7 @@ LEAF(csum_partial)
132 beqz t8, .Lqword_align 142 beqz t8, .Lqword_align
133 andi t8, src, 0x8 143 andi t8, src, 0x8
134 144
135 lw t0, 0x00(src) 145 LOAD32 t0, 0x00(src)
136 LONG_SUBU a1, a1, 0x4 146 LONG_SUBU a1, a1, 0x4
137 ADDC(sum, t0) 147 ADDC(sum, t0)
138 PTR_ADDU src, src, 0x4 148 PTR_ADDU src, src, 0x4
@@ -211,7 +221,7 @@ LEAF(csum_partial)
211 LONG_SRL t8, t8, 0x2 221 LONG_SRL t8, t8, 0x2
212 222
213.Lend_words: 223.Lend_words:
214 lw t0, (src) 224 LOAD32 t0, (src)
215 LONG_SUBU t8, t8, 0x1 225 LONG_SUBU t8, t8, 0x1
216 ADDC(sum, t0) 226 ADDC(sum, t0)
217 .set reorder /* DADDI_WAR */ 227 .set reorder /* DADDI_WAR */
@@ -230,6 +240,9 @@ LEAF(csum_partial)
230 /* Still a full word to go */ 240 /* Still a full word to go */
231 ulw t1, (src) 241 ulw t1, (src)
232 PTR_ADDIU src, 4 242 PTR_ADDIU src, 4
243#ifdef USE_DOUBLE
244 dsll t1, t1, 32 /* clear lower 32bit */
245#endif
233 ADDC(sum, t1) 246 ADDC(sum, t1)
234 247
2351: move t1, zero 2481: move t1, zero
@@ -280,7 +293,7 @@ LEAF(csum_partial)
2801: 2931:
281 .set reorder 294 .set reorder
282 /* Add the passed partial csum. */ 295 /* Add the passed partial csum. */
283 ADDC(sum, a2) 296 ADDC32(sum, a2)
284 jr ra 297 jr ra
285 .set noreorder 298 .set noreorder
286 END(csum_partial) 299 END(csum_partial)
@@ -681,7 +694,7 @@ EXC( sb t0, NBYTES-2(dst), .Ls_exc)
681 .set pop 694 .set pop
6821: 6951:
683 .set reorder 696 .set reorder
684 ADDC(sum, psum) 697 ADDC32(sum, psum)
685 jr ra 698 jr ra
686 .set noreorder 699 .set noreorder
687 700
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index cba36a247e32..92dd1a0ca352 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -72,6 +72,7 @@ static void irq_dispatch(unsigned int irq)
72 cascade = irq_cascade + irq; 72 cascade = irq_cascade + irq;
73 if (cascade->get_irq != NULL) { 73 if (cascade->get_irq != NULL) {
74 unsigned int source_irq = irq; 74 unsigned int source_irq = irq;
75 int ret;
75 desc = irq_desc + source_irq; 76 desc = irq_desc + source_irq;
76 if (desc->chip->mask_ack) 77 if (desc->chip->mask_ack)
77 desc->chip->mask_ack(source_irq); 78 desc->chip->mask_ack(source_irq);
@@ -79,8 +80,9 @@ static void irq_dispatch(unsigned int irq)
79 desc->chip->mask(source_irq); 80 desc->chip->mask(source_irq);
80 desc->chip->ack(source_irq); 81 desc->chip->ack(source_irq);
81 } 82 }
82 irq = cascade->get_irq(irq); 83 ret = cascade->get_irq(irq);
83 if (irq < 0) 84 irq = ret;
85 if (ret < 0)
84 atomic_inc(&irq_err_count); 86 atomic_inc(&irq_err_count);
85 else 87 else
86 irq_dispatch(irq); 88 irq_dispatch(irq);
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 717a3bc1352e..65d1a8454d2c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -195,7 +195,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
195image-$(CONFIG_PPC_CHRP) += zImage.chrp 195image-$(CONFIG_PPC_CHRP) += zImage.chrp
196image-$(CONFIG_PPC_EFIKA) += zImage.chrp 196image-$(CONFIG_PPC_EFIKA) += zImage.chrp
197image-$(CONFIG_PPC_PMAC) += zImage.pmac 197image-$(CONFIG_PPC_PMAC) += zImage.pmac
198image-$(CONFIG_PPC_HOLLY) += zImage.holly 198image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
200image-$(CONFIG_PPC_ISERIES) += zImage.iseries 200image-$(CONFIG_PPC_ISERIES) += zImage.iseries
201image-$(CONFIG_DEFAULT_UIMAGE) += uImage 201image-$(CONFIG_DEFAULT_UIMAGE) += uImage
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 3b3a1062cb25..584a4f184eb2 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -281,7 +281,7 @@
281 cell-index = <0>; 281 cell-index = <0>;
282 reg = <0x0 0x80>; 282 reg = <0x0 0x80>;
283 interrupt-parent = <&mpic>; 283 interrupt-parent = <&mpic>;
284 interrupts = <60 2>; 284 interrupts = <76 2>;
285 }; 285 };
286 dma-channel@1 { 286 dma-channel@1 {
287 compatible = "fsl,mpc8610-dma-channel", 287 compatible = "fsl,mpc8610-dma-channel",
@@ -289,7 +289,7 @@
289 cell-index = <1>; 289 cell-index = <1>;
290 reg = <0x80 0x80>; 290 reg = <0x80 0x80>;
291 interrupt-parent = <&mpic>; 291 interrupt-parent = <&mpic>;
292 interrupts = <61 2>; 292 interrupts = <77 2>;
293 }; 293 };
294 dma-channel@2 { 294 dma-channel@2 {
295 compatible = "fsl,mpc8610-dma-channel", 295 compatible = "fsl,mpc8610-dma-channel",
@@ -297,7 +297,7 @@
297 cell-index = <2>; 297 cell-index = <2>;
298 reg = <0x100 0x80>; 298 reg = <0x100 0x80>;
299 interrupt-parent = <&mpic>; 299 interrupt-parent = <&mpic>;
300 interrupts = <62 2>; 300 interrupts = <78 2>;
301 }; 301 };
302 dma-channel@3 { 302 dma-channel@3 {
303 compatible = "fsl,mpc8610-dma-channel", 303 compatible = "fsl,mpc8610-dma-channel",
@@ -305,7 +305,7 @@
305 cell-index = <3>; 305 cell-index = <3>;
306 reg = <0x180 0x80>; 306 reg = <0x180 0x80>;
307 interrupt-parent = <&mpic>; 307 interrupt-parent = <&mpic>;
308 interrupts = <63 2>; 308 interrupts = <79 2>;
309 }; 309 };
310 }; 310 };
311 311
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 80d1f399ee51..64c6ee22eefd 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -409,6 +409,13 @@ do { \
409/* Keep this the last entry. */ 409/* Keep this the last entry. */
410#define R_PPC64_NUM 107 410#define R_PPC64_NUM 107
411 411
412/* There's actually a third entry here, but it's unused */
413struct ppc64_opd_entry
414{
415 unsigned long funcaddr;
416 unsigned long r2;
417};
418
412#ifdef __KERNEL__ 419#ifdef __KERNEL__
413 420
414#ifdef CONFIG_SPU_BASE 421#ifdef CONFIG_SPU_BASE
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index 7710e9e6660f..07956f3e7844 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -2,6 +2,8 @@
2#define _ASM_POWERPC_SECTIONS_H 2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/elf.h>
6#include <linux/uaccess.h>
5#include <asm-generic/sections.h> 7#include <asm-generic/sections.h>
6 8
7#ifdef __powerpc64__ 9#ifdef __powerpc64__
@@ -17,7 +19,15 @@ static inline int in_kernel_text(unsigned long addr)
17} 19}
18 20
19#undef dereference_function_descriptor 21#undef dereference_function_descriptor
20void *dereference_function_descriptor(void *); 22static inline void *dereference_function_descriptor(void *ptr)
23{
24 struct ppc64_opd_entry *desc = ptr;
25 void *p;
26
27 if (!probe_kernel_address(&desc->funcaddr, p))
28 ptr = p;
29 return ptr;
30}
21 31
22#endif 32#endif
23 33
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index ad79de272ff3..1af2377e4992 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -21,9 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/bug.h> 23#include <linux/bug.h>
24#include <linux/uaccess.h>
25#include <asm/module.h> 24#include <asm/module.h>
26#include <asm/sections.h>
27#include <asm/firmware.h> 25#include <asm/firmware.h>
28#include <asm/code-patching.h> 26#include <asm/code-patching.h>
29#include <linux/sort.h> 27#include <linux/sort.h>
@@ -43,13 +41,6 @@
43#define DEBUGP(fmt , ...) 41#define DEBUGP(fmt , ...)
44#endif 42#endif
45 43
46/* There's actually a third entry here, but it's unused */
47struct ppc64_opd_entry
48{
49 unsigned long funcaddr;
50 unsigned long r2;
51};
52
53/* Like PPC32, we need little trampolines to do > 24-bit jumps (into 44/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
54 the kernel itself). But on PPC64, these need to be used for every 45 the kernel itself). But on PPC64, these need to be used for every
55 jump, actually, to reset r2 (TOC+0x8000). */ 46 jump, actually, to reset r2 (TOC+0x8000). */
@@ -452,13 +443,3 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
452 443
453 return 0; 444 return 0;
454} 445}
455
456void *dereference_function_descriptor(void *ptr)
457{
458 struct ppc64_opd_entry *desc = ptr;
459 void *p;
460
461 if (!probe_kernel_address(&desc->funcaddr, p))
462 ptr = p;
463 return ptr;
464}
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 23963882bc18..7495bc774685 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/linkage.h>
10#include <linux/ptrace.h> 11#include <linux/ptrace.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
12#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
@@ -866,7 +867,7 @@ static void kill_prom_timer(void)
866 : "g1", "g2"); 867 : "g1", "g2");
867} 868}
868 869
869void init_irqwork_curcpu(void) 870void notrace init_irqwork_curcpu(void)
870{ 871{
871 int cpu = hard_smp_processor_id(); 872 int cpu = hard_smp_processor_id();
872 873
@@ -897,7 +898,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
897 } 898 }
898} 899}
899 900
900void __cpuinit sun4v_register_mondo_queues(int this_cpu) 901void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu)
901{ 902{
902 struct trap_per_cpu *tb = &trap_block[this_cpu]; 903 struct trap_per_cpu *tb = &trap_block[this_cpu];
903 904
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index e205ade69cfc..f85b6bebb0be 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -575,7 +575,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
575{ 575{
576 unsigned long csr_reg, csr, csr_error_bits; 576 unsigned long csr_reg, csr, csr_error_bits;
577 irqreturn_t ret = IRQ_NONE; 577 irqreturn_t ret = IRQ_NONE;
578 u16 stat; 578 u16 stat, *addr;
579 579
580 if (is_pbm_a) { 580 if (is_pbm_a) {
581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL; 581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL;
@@ -597,7 +597,9 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
597 printk("%s: PCI SERR signal asserted.\n", pbm->name); 597 printk("%s: PCI SERR signal asserted.\n", pbm->name);
598 ret = IRQ_HANDLED; 598 ret = IRQ_HANDLED;
599 } 599 }
600 pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); 600 addr = psycho_pci_config_mkaddr(pbm, pbm->pci_first_busno,
601 0, PCI_STATUS);
602 pci_config_read16(addr, &stat);
601 if (stat & (PCI_STATUS_PARITY | 603 if (stat & (PCI_STATUS_PARITY |
602 PCI_STATUS_SIG_TARGET_ABORT | 604 PCI_STATUS_SIG_TARGET_ABORT |
603 PCI_STATUS_REC_TARGET_ABORT | 605 PCI_STATUS_REC_TARGET_ABORT |
@@ -605,7 +607,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
605 PCI_STATUS_SIG_SYSTEM_ERROR)) { 607 PCI_STATUS_SIG_SYSTEM_ERROR)) {
606 printk("%s: PCI bus error, PCI_STATUS[%04x]\n", 608 printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
607 pbm->name, stat); 609 pbm->name, stat);
608 pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); 610 pci_config_write16(addr, 0xffff);
609 ret = IRQ_HANDLED; 611 ret = IRQ_HANDLED;
610 } 612 }
611 return ret; 613 return ret;
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 3d924121c796..c824df13f589 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/linkage.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/signal.h> 15#include <linux/signal.h>
15#include <linux/smp.h> 16#include <linux/smp.h>
@@ -2453,7 +2454,7 @@ struct trap_per_cpu trap_block[NR_CPUS];
2453/* This can get invoked before sched_init() so play it super safe 2454/* This can get invoked before sched_init() so play it super safe
2454 * and use hard_smp_processor_id(). 2455 * and use hard_smp_processor_id().
2455 */ 2456 */
2456void init_cur_cpu_trap(struct thread_info *t) 2457void notrace init_cur_cpu_trap(struct thread_info *t)
2457{ 2458{
2458 int cpu = hard_smp_processor_id(); 2459 int cpu = hard_smp_processor_id();
2459 struct trap_per_cpu *p = &trap_block[cpu]; 2460 struct trap_per_cpu *p = &trap_block[cpu];
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8aab8517642e..4e456bd955bb 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -344,31 +344,15 @@ static void __init early_cpu_detect(void)
344 344
345/* 345/*
346 * The NOPL instruction is supposed to exist on all CPUs with 346 * The NOPL instruction is supposed to exist on all CPUs with
347 * family >= 6, unfortunately, that's not true in practice because 347 * family >= 6; unfortunately, that's not true in practice because
348 * of early VIA chips and (more importantly) broken virtualizers that 348 * of early VIA chips and (more importantly) broken virtualizers that
349 * are not easy to detect. Hence, probe for it based on first 349 * are not easy to detect. In the latter case it doesn't even *fail*
350 * principles. 350 * reliably, so probing for it doesn't even work. Disable it completely
351 * unless we can find a reliable way to detect all the broken cases.
351 */ 352 */
352static void __cpuinit detect_nopl(struct cpuinfo_x86 *c) 353static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
353{ 354{
354 const u32 nopl_signature = 0x888c53b1; /* Random number */
355 u32 has_nopl = nopl_signature;
356
357 clear_cpu_cap(c, X86_FEATURE_NOPL); 355 clear_cpu_cap(c, X86_FEATURE_NOPL);
358 if (c->x86 >= 6) {
359 asm volatile("\n"
360 "1: .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */
361 "2:\n"
362 " .section .fixup,\"ax\"\n"
363 "3: xor %0,%0\n"
364 " jmp 2b\n"
365 " .previous\n"
366 _ASM_EXTABLE(1b,3b)
367 : "+a" (has_nopl));
368
369 if (has_nopl == nopl_signature)
370 set_cpu_cap(c, X86_FEATURE_NOPL);
371 }
372} 356}
373 357
374static void __cpuinit generic_identify(struct cpuinfo_x86 *c) 358static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index f2d43bc75514..ff7d3b0124f1 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -139,6 +139,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
139 if (PageHighMem(pg)) { 139 if (PageHighMem(pg)) {
140 data = ioremap_cache(pa_data, sizeof(*data)); 140 data = ioremap_cache(pa_data, sizeof(*data));
141 if (!data) { 141 if (!data) {
142 kfree(node);
142 error = -ENXIO; 143 error = -ENXIO;
143 goto err_dir; 144 goto err_dir;
144 } 145 }
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 362d4e7f2d38..9838f2539dfc 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -670,6 +670,10 @@ void __init setup_arch(char **cmdline_p)
670 670
671 parse_early_param(); 671 parse_early_param();
672 672
673#ifdef CONFIG_X86_64
674 check_efer();
675#endif
676
673#if defined(CONFIG_VMI) && defined(CONFIG_X86_32) 677#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
674 /* 678 /*
675 * Must be before kernel pagetables are setup 679 * Must be before kernel pagetables are setup
@@ -738,7 +742,6 @@ void __init setup_arch(char **cmdline_p)
738#else 742#else
739 num_physpages = max_pfn; 743 num_physpages = max_pfn;
740 744
741 check_efer();
742 745
743 /* How many end-of-memory variables you have, grandma! */ 746 /* How many end-of-memory variables you have, grandma! */
744 /* need this before calling reserve_initrd */ 747 /* need this before calling reserve_initrd */
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index d37f29376b0c..60ec1d08ff24 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -458,11 +458,7 @@ static void __init pagetable_init(void)
458{ 458{
459 pgd_t *pgd_base = swapper_pg_dir; 459 pgd_t *pgd_base = swapper_pg_dir;
460 460
461 paravirt_pagetable_setup_start(pgd_base);
462
463 permanent_kmaps_init(pgd_base); 461 permanent_kmaps_init(pgd_base);
464
465 paravirt_pagetable_setup_done(pgd_base);
466} 462}
467 463
468#ifdef CONFIG_ACPI_SLEEP 464#ifdef CONFIG_ACPI_SLEEP
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index b6acc3a0af46..d67901083888 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -42,7 +42,7 @@ char * __init xen_memory_setup(void)
42 42
43 e820.nr_map = 0; 43 e820.nr_map = 0;
44 44
45 e820_add_region(0, PFN_PHYS(max_pfn), E820_RAM); 45 e820_add_region(0, PFN_PHYS((u64)max_pfn), E820_RAM);
46 46
47 /* 47 /*
48 * Even though this is normal, usable memory under Xen, reserve 48 * Even though this is normal, usable memory under Xen, reserve
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 4eee533f3f4a..71d2ac4e3f46 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -178,11 +178,13 @@ static int verify_pmtmr_rate(void)
178 178
179/* Number of monotonicity checks to perform during initialization */ 179/* Number of monotonicity checks to perform during initialization */
180#define ACPI_PM_MONOTONICITY_CHECKS 10 180#define ACPI_PM_MONOTONICITY_CHECKS 10
181/* Number of reads we try to get two different values */
182#define ACPI_PM_READ_CHECKS 10000
181 183
182static int __init init_acpi_pm_clocksource(void) 184static int __init init_acpi_pm_clocksource(void)
183{ 185{
184 cycle_t value1, value2; 186 cycle_t value1, value2;
185 unsigned int i, j, good = 0; 187 unsigned int i, j = 0;
186 188
187 if (!pmtmr_ioport) 189 if (!pmtmr_ioport)
188 return -ENODEV; 190 return -ENODEV;
@@ -192,29 +194,26 @@ static int __init init_acpi_pm_clocksource(void)
192 194
193 /* "verify" this timing source: */ 195 /* "verify" this timing source: */
194 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { 196 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
197 udelay(100 * j);
195 value1 = clocksource_acpi_pm.read(); 198 value1 = clocksource_acpi_pm.read();
196 for (i = 0; i < 10000; i++) { 199 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
197 value2 = clocksource_acpi_pm.read(); 200 value2 = clocksource_acpi_pm.read();
198 if (value2 == value1) 201 if (value2 == value1)
199 continue; 202 continue;
200 if (value2 > value1) 203 if (value2 > value1)
201 good++;
202 break; 204 break;
203 if ((value2 < value1) && ((value2) < 0xFFF)) 205 if ((value2 < value1) && ((value2) < 0xFFF))
204 good++;
205 break; 206 break;
206 printk(KERN_INFO "PM-Timer had inconsistent results:" 207 printk(KERN_INFO "PM-Timer had inconsistent results:"
207 " 0x%#llx, 0x%#llx - aborting.\n", 208 " 0x%#llx, 0x%#llx - aborting.\n",
208 value1, value2); 209 value1, value2);
209 return -EINVAL; 210 return -EINVAL;
210 } 211 }
211 udelay(300 * i); 212 if (i == ACPI_PM_READ_CHECKS) {
212 } 213 printk(KERN_INFO "PM-Timer failed consistency check "
213 214 " (0x%#llx) - aborting.\n", value1);
214 if (good != ACPI_PM_MONOTONICITY_CHECKS) { 215 return -ENODEV;
215 printk(KERN_INFO "PM-Timer failed consistency check " 216 }
216 " (0x%#llx) - aborting.\n", value1);
217 return -ENODEV;
218 } 217 }
219 218
220 if (verify_pmtmr_rate() != 0) 219 if (verify_pmtmr_rate() != 0)
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c
index ce8d94fbfd7e..bfda8c80ef24 100644
--- a/drivers/hwmon/ad7414.c
+++ b/drivers/hwmon/ad7414.c
@@ -69,7 +69,7 @@ static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
69 return i2c_smbus_write_byte_data(client, reg, value); 69 return i2c_smbus_write_byte_data(client, reg, value);
70} 70}
71 71
72struct ad7414_data *ad7414_update_device(struct device *dev) 72static struct ad7414_data *ad7414_update_device(struct device *dev)
73{ 73{
74 struct i2c_client *client = to_i2c_client(dev); 74 struct i2c_client *client = to_i2c_client(dev);
75 struct ad7414_data *data = i2c_get_clientdata(client); 75 struct ad7414_data *data = i2c_get_clientdata(client);
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index d191118ba0cb..d6b490d3e36f 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -31,7 +31,7 @@
31 31
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); 33MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
34MODULE_VERSION("0.6.2"); 34MODULE_VERSION("0.6.3");
35MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); 35MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
36 36
37#define ATXP1_VID 0x00 37#define ATXP1_VID 0x00
@@ -289,16 +289,16 @@ static int atxp1_detect(struct i2c_client *new_client, int kind,
289 if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && 289 if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) &&
290 (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && 290 (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) &&
291 (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && 291 (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) &&
292 (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) { 292 (i2c_smbus_read_byte_data(new_client, 0xff) == 0)))
293 return -ENODEV;
293 294
294 /* No vendor ID, now checking if registers 0x10,0x11 (non-existent) 295 /* No vendor ID, now checking if registers 0x10,0x11 (non-existent)
295 * showing the same as register 0x00 */ 296 * showing the same as register 0x00 */
296 temp = i2c_smbus_read_byte_data(new_client, 0x00); 297 temp = i2c_smbus_read_byte_data(new_client, 0x00);
297 298
298 if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && 299 if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) &&
299 (i2c_smbus_read_byte_data(new_client, 0x11) == temp) )) 300 (i2c_smbus_read_byte_data(new_client, 0x11) == temp)))
300 return -ENODEV; 301 return -ENODEV;
301 }
302 302
303 /* Get VRM */ 303 /* Get VRM */
304 temp = vid_which_vrm(); 304 temp = vid_which_vrm();
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 30cdb0956779..f1133081cc42 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -273,10 +273,10 @@ struct it87_data {
273static inline int has_16bit_fans(const struct it87_data *data) 273static inline int has_16bit_fans(const struct it87_data *data)
274{ 274{
275 /* IT8705F Datasheet 0.4.1, 3h == Version G. 275 /* IT8705F Datasheet 0.4.1, 3h == Version G.
276 IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I. 276 IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J.
277 These are the first revisions with 16bit tachometer support. */ 277 These are the first revisions with 16bit tachometer support. */
278 return (data->type == it87 && data->revision >= 0x03) 278 return (data->type == it87 && data->revision >= 0x03)
279 || (data->type == it8712 && data->revision >= 0x07) 279 || (data->type == it8712 && data->revision >= 0x08)
280 || data->type == it8716 280 || data->type == it8716
281 || data->type == it8718; 281 || data->type == it8718;
282} 282}
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index f29dbb767e87..9559248f265b 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1342,6 +1342,12 @@ static __be32 convert_access(int acc)
1342static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr) 1342static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr)
1343{ 1343{
1344 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list); 1344 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list);
1345 int i;
1346
1347 for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i)
1348 wr->wr.fast_reg.page_list->page_list[i] =
1349 cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] |
1350 MLX4_MTT_FLAG_PRESENT);
1345 1351
1346 fseg->flags = convert_access(wr->wr.fast_reg.access_flags); 1352 fseg->flags = convert_access(wr->wr.fast_reg.access_flags);
1347 fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey); 1353 fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey);
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 9f0b964b2c99..499d3cf83e1f 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1956,13 +1956,6 @@ static int mini_cm_reject(struct nes_cm_core *cm_core,
1956 return ret; 1956 return ret;
1957 cleanup_retrans_entry(cm_node); 1957 cleanup_retrans_entry(cm_node);
1958 cm_node->state = NES_CM_STATE_CLOSED; 1958 cm_node->state = NES_CM_STATE_CLOSED;
1959 ret = send_fin(cm_node, NULL);
1960
1961 if (cm_node->accept_pend) {
1962 BUG_ON(!cm_node->listener);
1963 atomic_dec(&cm_node->listener->pend_accepts_cnt);
1964 BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0);
1965 }
1966 1959
1967 ret = send_reset(cm_node, NULL); 1960 ret = send_reset(cm_node, NULL);
1968 return ret; 1961 return ret;
@@ -2383,6 +2376,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
2383 atomic_inc(&cm_disconnects); 2376 atomic_inc(&cm_disconnects);
2384 cm_event.event = IW_CM_EVENT_DISCONNECT; 2377 cm_event.event = IW_CM_EVENT_DISCONNECT;
2385 if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) { 2378 if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) {
2379 issued_disconnect_reset = 1;
2386 cm_event.status = IW_CM_EVENT_STATUS_RESET; 2380 cm_event.status = IW_CM_EVENT_STATUS_RESET;
2387 nes_debug(NES_DBG_CM, "Generating a CM " 2381 nes_debug(NES_DBG_CM, "Generating a CM "
2388 "Disconnect Event (status reset) for " 2382 "Disconnect Event (status reset) for "
@@ -2508,7 +2502,6 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
2508 nes_debug(NES_DBG_CM, "Call close API\n"); 2502 nes_debug(NES_DBG_CM, "Call close API\n");
2509 2503
2510 g_cm_core->api->close(g_cm_core, nesqp->cm_node); 2504 g_cm_core->api->close(g_cm_core, nesqp->cm_node);
2511 nesqp->cm_node = NULL;
2512 } 2505 }
2513 2506
2514 return ret; 2507 return ret;
@@ -2837,6 +2830,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2837 cm_node->apbvt_set = 1; 2830 cm_node->apbvt_set = 1;
2838 nesqp->cm_node = cm_node; 2831 nesqp->cm_node = cm_node;
2839 cm_node->nesqp = nesqp; 2832 cm_node->nesqp = nesqp;
2833 nes_add_ref(&nesqp->ibqp);
2840 2834
2841 return 0; 2835 return 0;
2842} 2836}
@@ -3167,7 +3161,6 @@ static void cm_event_connect_error(struct nes_cm_event *event)
3167 if (ret) 3161 if (ret)
3168 printk(KERN_ERR "%s[%u] OFA CM event_handler returned, " 3162 printk(KERN_ERR "%s[%u] OFA CM event_handler returned, "
3169 "ret=%d\n", __func__, __LINE__, ret); 3163 "ret=%d\n", __func__, __LINE__, ret);
3170 nes_rem_ref(&nesqp->ibqp);
3171 cm_id->rem_ref(cm_id); 3164 cm_id->rem_ref(cm_id);
3172 3165
3173 rem_ref_cm_node(event->cm_node->cm_core, event->cm_node); 3166 rem_ref_cm_node(event->cm_node->cm_core, event->cm_node);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index b0ffc9abe8c0..05eb41b8ab63 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -293,6 +293,7 @@ struct ipoib_dev_priv {
293 293
294 struct delayed_work pkey_poll_task; 294 struct delayed_work pkey_poll_task;
295 struct delayed_work mcast_task; 295 struct delayed_work mcast_task;
296 struct work_struct carrier_on_task;
296 struct work_struct flush_light; 297 struct work_struct flush_light;
297 struct work_struct flush_normal; 298 struct work_struct flush_normal;
298 struct work_struct flush_heavy; 299 struct work_struct flush_heavy;
@@ -464,6 +465,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
464void ipoib_dev_cleanup(struct net_device *dev); 465void ipoib_dev_cleanup(struct net_device *dev);
465 466
466void ipoib_mcast_join_task(struct work_struct *work); 467void ipoib_mcast_join_task(struct work_struct *work);
468void ipoib_mcast_carrier_on_task(struct work_struct *work);
467void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb); 469void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb);
468 470
469void ipoib_mcast_restart_task(struct work_struct *work); 471void ipoib_mcast_restart_task(struct work_struct *work);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 7e9e218738fa..1b1df5cc4113 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1075,6 +1075,7 @@ static void ipoib_setup(struct net_device *dev)
1075 1075
1076 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll); 1076 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
1077 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); 1077 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
1078 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
1078 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light); 1079 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light);
1079 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal); 1080 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal);
1080 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy); 1081 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index ac33c8f3ea85..aae28620a6e5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -366,6 +366,21 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast)
366 return ret; 366 return ret;
367} 367}
368 368
369void ipoib_mcast_carrier_on_task(struct work_struct *work)
370{
371 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
372 carrier_on_task);
373
374 /*
375 * Take rtnl_lock to avoid racing with ipoib_stop() and
376 * turning the carrier back on while a device is being
377 * removed.
378 */
379 rtnl_lock();
380 netif_carrier_on(priv->dev);
381 rtnl_unlock();
382}
383
369static int ipoib_mcast_join_complete(int status, 384static int ipoib_mcast_join_complete(int status,
370 struct ib_sa_multicast *multicast) 385 struct ib_sa_multicast *multicast)
371{ 386{
@@ -392,16 +407,12 @@ static int ipoib_mcast_join_complete(int status,
392 &priv->mcast_task, 0); 407 &priv->mcast_task, 0);
393 mutex_unlock(&mcast_mutex); 408 mutex_unlock(&mcast_mutex);
394 409
395 if (mcast == priv->broadcast) { 410 /*
396 /* 411 * Defer carrier on work to ipoib_workqueue to avoid a
397 * Take RTNL lock here to avoid racing with 412 * deadlock on rtnl_lock here.
398 * ipoib_stop() and turning the carrier back 413 */
399 * on while a device is being removed. 414 if (mcast == priv->broadcast)
400 */ 415 queue_work(ipoib_workqueue, &priv->carrier_on_task);
401 rtnl_lock();
402 netif_carrier_on(dev);
403 rtnl_unlock();
404 }
405 416
406 return 0; 417 return 0;
407 } 418 }
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4790c83d78d0..deeac4b44173 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5761,7 +5761,11 @@ void md_do_sync(mddev_t *mddev)
5761 * time 'round when curr_resync == 2 5761 * time 'round when curr_resync == 2
5762 */ 5762 */
5763 continue; 5763 continue;
5764 prepare_to_wait(&resync_wait, &wq, TASK_UNINTERRUPTIBLE); 5764 /* We need to wait 'interruptible' so as not to
5765 * contribute to the load average, and not to
5766 * be caught by 'softlockup'
5767 */
5768 prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE);
5765 if (!kthread_should_stop() && 5769 if (!kthread_should_stop() &&
5766 mddev2->curr_resync >= mddev->curr_resync) { 5770 mddev2->curr_resync >= mddev->curr_resync) {
5767 printk(KERN_INFO "md: delaying %s of %s" 5771 printk(KERN_INFO "md: delaying %s of %s"
@@ -5769,6 +5773,8 @@ void md_do_sync(mddev_t *mddev)
5769 " share one or more physical units)\n", 5773 " share one or more physical units)\n",
5770 desc, mdname(mddev), mdname(mddev2)); 5774 desc, mdname(mddev), mdname(mddev2));
5771 mddev_put(mddev2); 5775 mddev_put(mddev2);
5776 if (signal_pending(current))
5777 flush_signals(current);
5772 schedule(); 5778 schedule();
5773 finish_wait(&resync_wait, &wq); 5779 finish_wait(&resync_wait, &wq);
5774 goto try_again; 5780 goto try_again;
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 6986f3926244..ebc8b9d77613 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -615,14 +615,19 @@ static struct mmc_driver mmc_driver = {
615 615
616static int __init mmc_blk_init(void) 616static int __init mmc_blk_init(void)
617{ 617{
618 int res = -ENOMEM; 618 int res;
619 619
620 res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); 620 res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
621 if (res) 621 if (res)
622 goto out; 622 goto out;
623 623
624 return mmc_register_driver(&mmc_driver); 624 res = mmc_register_driver(&mmc_driver);
625 if (res)
626 goto out2;
625 627
628 return 0;
629 out2:
630 unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
626 out: 631 out:
627 return res; 632 return res;
628} 633}
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index f26b01d811ae..b92b172074ee 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = {
1040 1040
1041}; 1041};
1042 1042
1043static struct mutex mmc_test_lock; 1043static DEFINE_MUTEX(mmc_test_lock);
1044 1044
1045static void mmc_test_run(struct mmc_test_card *test, int testcase) 1045static void mmc_test_run(struct mmc_test_card *test, int testcase)
1046{ 1046{
@@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card)
1171 if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) 1171 if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD))
1172 return -ENODEV; 1172 return -ENODEV;
1173 1173
1174 mutex_init(&mmc_test_lock);
1175
1176 ret = device_create_file(&card->dev, &dev_attr_test); 1174 ret = device_create_file(&card->dev, &dev_attr_test);
1177 if (ret) 1175 if (ret)
1178 return ret; 1176 return ret;
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 0bd06f5bd62f..917035e16da4 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v)
195 195
196 /* Grab a more or less consistent snapshot */ 196 /* Grab a more or less consistent snapshot */
197 spin_lock_irq(&host->mmc->lock); 197 spin_lock_irq(&host->mmc->lock);
198 clk_enable(host->mck);
198 memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); 199 memcpy_fromio(buf, host->regs, MCI_REGS_SIZE);
200 clk_disable(host->mck);
199 spin_unlock_irq(&host->mmc->lock); 201 spin_unlock_irq(&host->mmc->lock);
200 202
201 seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", 203 seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n",
@@ -216,6 +218,8 @@ static int atmci_regs_show(struct seq_file *s, void *v)
216 atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); 218 atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]);
217 atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); 219 atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]);
218 220
221 kfree(buf);
222
219 return 0; 223 return 0;
220} 224}
221 225
@@ -237,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
237 struct mmc_host *mmc; 241 struct mmc_host *mmc;
238 struct dentry *root; 242 struct dentry *root;
239 struct dentry *node; 243 struct dentry *node;
240 struct resource *res;
241 244
242 mmc = host->mmc; 245 mmc = host->mmc;
243 root = mmc->debugfs_root; 246 root = mmc->debugfs_root;
@@ -251,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
251 if (!node) 254 if (!node)
252 goto err; 255 goto err;
253 256
254 res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
255 node->d_inode->i_size = res->end - res->start + 1;
256
257 node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); 257 node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops);
258 if (!node) 258 if (!node)
259 goto err; 259 goto err;
@@ -1059,6 +1059,10 @@ static int __init atmci_probe(struct platform_device *pdev)
1059 host->present = !gpio_get_value(host->detect_pin); 1059 host->present = !gpio_get_value(host->detect_pin);
1060 } 1060 }
1061 } 1061 }
1062
1063 if (!gpio_is_valid(host->detect_pin))
1064 mmc->caps |= MMC_CAP_NEEDS_POLL;
1065
1062 if (gpio_is_valid(host->wp_pin)) { 1066 if (gpio_is_valid(host->wp_pin)) {
1063 if (gpio_request(host->wp_pin, "mmc_wp")) { 1067 if (gpio_request(host->wp_pin, "mmc_wp")) {
1064 dev_dbg(&mmc->class_dev, "no WP pin available\n"); 1068 dev_dbg(&mmc->class_dev, "no WP pin available\n");
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9e647a06054f..ba2b4240a86a 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -159,10 +159,10 @@ static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host,
159#define STATUS_TO_TEXT(a) \ 159#define STATUS_TO_TEXT(a) \
160 do { \ 160 do { \
161 if (status & TMIO_STAT_##a) \ 161 if (status & TMIO_STAT_##a) \
162 printf(#a); \ 162 printk(#a); \
163 } while (0) 163 } while (0)
164 164
165void debug_status(u32 status) 165void pr_debug_status(u32 status)
166{ 166{
167 printk(KERN_DEBUG "status: %08x = ", status); 167 printk(KERN_DEBUG "status: %08x = ", status);
168 STATUS_TO_TEXT(CARD_REMOVE); 168 STATUS_TO_TEXT(CARD_REMOVE);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index c3c579f98ed0..dfacd31f7ed0 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6597,7 +6597,7 @@ struct flash_spec {
6597 6597
6598struct bnx2_irq { 6598struct bnx2_irq {
6599 irq_handler_t handler; 6599 irq_handler_t handler;
6600 u16 vector; 6600 unsigned int vector;
6601 u8 requested; 6601 u8 requested;
6602 char name[16]; 6602 char name[16];
6603}; 6603};
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 453115acaad2..5cf78d612c45 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2738,9 +2738,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2738 nic->flags |= wol_magic; 2738 nic->flags |= wol_magic;
2739 2739
2740 /* ack any pending wake events, disable PME */ 2740 /* ack any pending wake events, disable PME */
2741 err = pci_enable_wake(pdev, 0, 0); 2741 pci_pme_active(pdev, false);
2742 if (err)
2743 DPRINTK(PROBE, ERR, "Error clearing wake event\n");
2744 2742
2745 strcpy(netdev->name, "eth%d"); 2743 strcpy(netdev->name, "eth%d");
2746 if((err = register_netdev(netdev))) { 2744 if((err = register_netdev(netdev))) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 9d6edf3e73f9..d04eef53571e 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(struct e1000_hw *hw, u8 *buffer);
144static u8 e1000_calculate_mng_checksum(char *buffer, u32 length); 144static u8 e1000_calculate_mng_checksum(char *buffer, u32 length);
145static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex); 145static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex);
146static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw); 146static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
147static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
148static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
147 149
148/* IGP cable length table */ 150/* IGP cable length table */
149static const 151static const
@@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] =
168 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, 170 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
169 104, 109, 114, 118, 121, 124}; 171 104, 109, 114, 118, 121, 124};
170 172
173static DEFINE_SPINLOCK(e1000_eeprom_lock);
174
171/****************************************************************************** 175/******************************************************************************
172 * Set the phy type member in the hw struct. 176 * Set the phy type member in the hw struct.
173 * 177 *
@@ -4904,6 +4908,15 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw)
4904 *****************************************************************************/ 4908 *****************************************************************************/
4905s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 4909s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
4906{ 4910{
4911 s32 ret;
4912 spin_lock(&e1000_eeprom_lock);
4913 ret = e1000_do_read_eeprom(hw, offset, words, data);
4914 spin_unlock(&e1000_eeprom_lock);
4915 return ret;
4916}
4917
4918static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
4919{
4907 struct e1000_eeprom_info *eeprom = &hw->eeprom; 4920 struct e1000_eeprom_info *eeprom = &hw->eeprom;
4908 u32 i = 0; 4921 u32 i = 0;
4909 4922
@@ -5236,6 +5249,16 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
5236 *****************************************************************************/ 5249 *****************************************************************************/
5237s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 5250s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
5238{ 5251{
5252 s32 ret;
5253 spin_lock(&e1000_eeprom_lock);
5254 ret = e1000_do_write_eeprom(hw, offset, words, data);
5255 spin_unlock(&e1000_eeprom_lock);
5256 return ret;
5257}
5258
5259
5260static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
5261{
5239 struct e1000_eeprom_info *eeprom = &hw->eeprom; 5262 struct e1000_eeprom_info *eeprom = &hw->eeprom;
5240 s32 status = 0; 5263 s32 status = 0;
5241 5264
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 0b6ecef9a849..eeb55ed2152d 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5643,6 +5643,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5643 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; 5643 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
5644 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; 5644 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
5645 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); 5645 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
5646 printk(KERN_DEBUG "nv_probe: set workaround bit for reversed mac addr\n");
5646 } 5647 }
5647 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 5648 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
5648 5649
@@ -5890,14 +5891,12 @@ static void nv_restore_phy(struct net_device *dev)
5890 } 5891 }
5891} 5892}
5892 5893
5893static void __devexit nv_remove(struct pci_dev *pci_dev) 5894static void nv_restore_mac_addr(struct pci_dev *pci_dev)
5894{ 5895{
5895 struct net_device *dev = pci_get_drvdata(pci_dev); 5896 struct net_device *dev = pci_get_drvdata(pci_dev);
5896 struct fe_priv *np = netdev_priv(dev); 5897 struct fe_priv *np = netdev_priv(dev);
5897 u8 __iomem *base = get_hwbase(dev); 5898 u8 __iomem *base = get_hwbase(dev);
5898 5899
5899 unregister_netdev(dev);
5900
5901 /* special op: write back the misordered MAC address - otherwise 5900 /* special op: write back the misordered MAC address - otherwise
5902 * the next nv_probe would see a wrong address. 5901 * the next nv_probe would see a wrong address.
5903 */ 5902 */
@@ -5905,6 +5904,15 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
5905 writel(np->orig_mac[1], base + NvRegMacAddrB); 5904 writel(np->orig_mac[1], base + NvRegMacAddrB);
5906 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV, 5905 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
5907 base + NvRegTransmitPoll); 5906 base + NvRegTransmitPoll);
5907}
5908
5909static void __devexit nv_remove(struct pci_dev *pci_dev)
5910{
5911 struct net_device *dev = pci_get_drvdata(pci_dev);
5912
5913 unregister_netdev(dev);
5914
5915 nv_restore_mac_addr(pci_dev);
5908 5916
5909 /* restore any phy related changes */ 5917 /* restore any phy related changes */
5910 nv_restore_phy(dev); 5918 nv_restore_phy(dev);
@@ -5975,6 +5983,8 @@ static void nv_shutdown(struct pci_dev *pdev)
5975 if (netif_running(dev)) 5983 if (netif_running(dev))
5976 nv_close(dev); 5984 nv_close(dev);
5977 5985
5986 nv_restore_mac_addr(pdev);
5987
5978 pci_disable_device(pdev); 5988 pci_disable_device(pdev);
5979 if (system_state == SYSTEM_POWER_OFF) { 5989 if (system_state == SYSTEM_POWER_OFF) {
5980 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled)) 5990 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 8239939554bc..fbbd3e660c27 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -139,7 +139,7 @@ static int __init do_hpp_probe(struct net_device *dev)
139#ifndef MODULE 139#ifndef MODULE
140struct net_device * __init hp_plus_probe(int unit) 140struct net_device * __init hp_plus_probe(int unit)
141{ 141{
142 struct net_device *dev = alloc_ei_netdev(); 142 struct net_device *dev = alloc_eip_netdev();
143 int err; 143 int err;
144 144
145 if (!dev) 145 if (!dev)
@@ -284,7 +284,7 @@ hpp_open(struct net_device *dev)
284 int option_reg; 284 int option_reg;
285 int retval; 285 int retval;
286 286
287 if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { 287 if ((retval = request_irq(dev->irq, eip_interrupt, 0, dev->name, dev))) {
288 return retval; 288 return retval;
289 } 289 }
290 290
@@ -302,7 +302,7 @@ hpp_open(struct net_device *dev)
302 /* Select the operational page. */ 302 /* Select the operational page. */
303 outw(Perf_Page, ioaddr + HP_PAGING); 303 outw(Perf_Page, ioaddr + HP_PAGING);
304 304
305 ei_open(dev); 305 eip_open(dev);
306 return 0; 306 return 0;
307} 307}
308 308
@@ -313,7 +313,7 @@ hpp_close(struct net_device *dev)
313 int option_reg = inw(ioaddr + HPP_OPTION); 313 int option_reg = inw(ioaddr + HPP_OPTION);
314 314
315 free_irq(dev->irq, dev); 315 free_irq(dev->irq, dev);
316 ei_close(dev); 316 eip_close(dev);
317 outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset, 317 outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset,
318 ioaddr + HPP_OPTION); 318 ioaddr + HPP_OPTION);
319 319
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index 62071d9c4a55..d1dd5b48dbd1 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -67,11 +67,10 @@ struct mlx4_mpt_entry {
67#define MLX4_MPT_FLAG_PHYSICAL (1 << 9) 67#define MLX4_MPT_FLAG_PHYSICAL (1 << 9)
68#define MLX4_MPT_FLAG_REGION (1 << 8) 68#define MLX4_MPT_FLAG_REGION (1 << 8)
69 69
70#define MLX4_MPT_PD_FLAG_FAST_REG (1 << 26) 70#define MLX4_MPT_PD_FLAG_FAST_REG (1 << 27)
71#define MLX4_MPT_PD_FLAG_RAE (1 << 28)
71#define MLX4_MPT_PD_FLAG_EN_INV (3 << 24) 72#define MLX4_MPT_PD_FLAG_EN_INV (3 << 24)
72 73
73#define MLX4_MTT_FLAG_PRESENT 1
74
75#define MLX4_MPT_STATUS_SW 0xF0 74#define MLX4_MPT_STATUS_SW 0xF0
76#define MLX4_MPT_STATUS_HW 0x00 75#define MLX4_MPT_STATUS_HW 0x00
77 76
@@ -348,7 +347,10 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
348 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { 347 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) {
349 /* fast register MR in free state */ 348 /* fast register MR in free state */
350 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); 349 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE);
351 mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG); 350 mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG |
351 MLX4_MPT_PD_FLAG_RAE);
352 mpt_entry->mtt_sz = cpu_to_be32((1 << mr->mtt.order) *
353 MLX4_MTT_ENTRY_PER_SEG);
352 } else { 354 } else {
353 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); 355 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS);
354 } 356 }
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index fec5645944a4..34ae125d5384 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -43,23 +43,6 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
43 return 0; 43 return 0;
44} 44}
45 45
46/* Update the rfkill state */
47static void b43_rfkill_update_state(struct b43_wldev *dev)
48{
49 struct b43_rfkill *rfk = &(dev->wl->rfkill);
50
51 if (!dev->radio_hw_enable) {
52 rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
53 return;
54 }
55
56 if (!dev->phy.radio_on)
57 rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
58 else
59 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
60
61}
62
63/* The poll callback for the hardware button. */ 46/* The poll callback for the hardware button. */
64static void b43_rfkill_poll(struct input_polled_dev *poll_dev) 47static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
65{ 48{
@@ -77,7 +60,6 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
77 if (unlikely(enabled != dev->radio_hw_enable)) { 60 if (unlikely(enabled != dev->radio_hw_enable)) {
78 dev->radio_hw_enable = enabled; 61 dev->radio_hw_enable = enabled;
79 report_change = 1; 62 report_change = 1;
80 b43_rfkill_update_state(dev);
81 b43info(wl, "Radio hardware status changed to %s\n", 63 b43info(wl, "Radio hardware status changed to %s\n",
82 enabled ? "ENABLED" : "DISABLED"); 64 enabled ? "ENABLED" : "DISABLED");
83 } 65 }
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index 476add97e974..b32bf6a94f19 100644
--- a/drivers/net/wireless/b43legacy/rfkill.c
+++ b/drivers/net/wireless/b43legacy/rfkill.c
@@ -44,23 +44,6 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
44 return 0; 44 return 0;
45} 45}
46 46
47/* Update the rfkill state */
48static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev)
49{
50 struct b43legacy_rfkill *rfk = &(dev->wl->rfkill);
51
52 if (!dev->radio_hw_enable) {
53 rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
54 return;
55 }
56
57 if (!dev->phy.radio_on)
58 rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
59 else
60 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
61
62}
63
64/* The poll callback for the hardware button. */ 47/* The poll callback for the hardware button. */
65static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) 48static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
66{ 49{
@@ -78,7 +61,6 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
78 if (unlikely(enabled != dev->radio_hw_enable)) { 61 if (unlikely(enabled != dev->radio_hw_enable)) {
79 dev->radio_hw_enable = enabled; 62 dev->radio_hw_enable = enabled;
80 report_change = 1; 63 report_change = 1;
81 b43legacy_rfkill_update_state(dev);
82 b43legacyinfo(wl, "Radio hardware status changed to %s\n", 64 b43legacyinfo(wl, "Radio hardware status changed to %s\n",
83 enabled ? "ENABLED" : "DISABLED"); 65 enabled ? "ENABLED" : "DISABLED");
84 } 66 }
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index e0ce65fca4e7..9a50f245774b 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -113,7 +113,8 @@ ccwgroup_release (struct device *dev)
113 113
114 for (i = 0; i < gdev->count; i++) { 114 for (i = 0; i < gdev->count; i++) {
115 if (gdev->cdev[i]) { 115 if (gdev->cdev[i]) {
116 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 116 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
117 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
117 put_device(&gdev->cdev[i]->dev); 118 put_device(&gdev->cdev[i]->dev);
118 } 119 }
119 } 120 }
@@ -296,6 +297,7 @@ error:
296 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) 297 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
297 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 298 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
298 put_device(&gdev->cdev[i]->dev); 299 put_device(&gdev->cdev[i]->dev);
300 gdev->cdev[i] = NULL;
299 } 301 }
300 mutex_unlock(&gdev->reg_mutex); 302 mutex_unlock(&gdev->reg_mutex);
301 put_device(&gdev->dev); 303 put_device(&gdev->dev);
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 5954b905e3ca..326f4cc7f92c 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -174,6 +174,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
174 CIO_TRACE_EVENT(4, sch->dev.bus_id); 174 CIO_TRACE_EVENT(4, sch->dev.bus_id);
175 175
176 orb = &to_io_private(sch)->orb; 176 orb = &to_io_private(sch)->orb;
177 memset(orb, 0, sizeof(union orb));
177 /* sch is always under 2G. */ 178 /* sch is always under 2G. */
178 orb->cmd.intparm = (u32)(addr_t)sch; 179 orb->cmd.intparm = (u32)(addr_t)sch;
179 orb->cmd.fmt = 1; 180 orb->cmd.fmt = 1;
diff --git a/fs/Kconfig b/fs/Kconfig
index abccb5dab9a8..ed57a5a37250 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -419,6 +419,14 @@ config FS_POSIX_ACL
419 bool 419 bool
420 default n 420 default n
421 421
422config FILE_LOCKING
423 bool "Enable POSIX file locking API" if EMBEDDED
424 default y
425 help
426 This option enables standard file locking support, required
427 for filesystems like NFS and for the flock() system
428 call. Disabling this option saves about 11k.
429
422source "fs/xfs/Kconfig" 430source "fs/xfs/Kconfig"
423source "fs/gfs2/Kconfig" 431source "fs/gfs2/Kconfig"
424 432
@@ -1765,6 +1773,28 @@ config SUNRPC_XPRT_RDMA
1765 1773
1766 If unsure, say N. 1774 If unsure, say N.
1767 1775
1776config SUNRPC_REGISTER_V4
1777 bool "Register local RPC services via rpcbind v4 (EXPERIMENTAL)"
1778 depends on SUNRPC && EXPERIMENTAL
1779 default n
1780 help
1781 Sun added support for registering RPC services at an IPv6
1782 address by creating two new versions of the rpcbind protocol
1783 (RFC 1833).
1784
1785 This option enables support in the kernel RPC server for
1786 registering kernel RPC services via version 4 of the rpcbind
1787 protocol. If you enable this option, you must run a portmapper
1788 daemon that supports rpcbind protocol version 4.
1789
1790 Serving NFS over IPv6 from knfsd (the kernel's NFS server)
1791 requires that you enable this option and use a portmapper that
1792 supports rpcbind version 4.
1793
1794 If unsure, say N to get traditional behavior (register kernel
1795 RPC services using only rpcbind version 2). Distributions
1796 using the legacy Linux portmapper daemon must say N here.
1797
1768config RPCSEC_GSS_KRB5 1798config RPCSEC_GSS_KRB5
1769 tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)" 1799 tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)"
1770 depends on SUNRPC && EXPERIMENTAL 1800 depends on SUNRPC && EXPERIMENTAL
diff --git a/fs/Makefile b/fs/Makefile
index a1482a5eff15..4b86d433baaf 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -7,7 +7,7 @@
7 7
8obj-y := open.o read_write.o file_table.o super.o \ 8obj-y := open.o read_write.o file_table.o super.o \
9 char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ 9 char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
10 ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ 10 ioctl.o readdir.o select.o fifo.o dcache.o inode.o \
11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ 11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
12 seq_file.o xattr.o libfs.o fs-writeback.o \ 12 seq_file.o xattr.o libfs.o fs-writeback.o \
13 pnode.o drop_caches.o splice.o sync.o utimes.o \ 13 pnode.o drop_caches.o splice.o sync.o utimes.o \
@@ -27,6 +27,7 @@ obj-$(CONFIG_ANON_INODES) += anon_inodes.o
27obj-$(CONFIG_SIGNALFD) += signalfd.o 27obj-$(CONFIG_SIGNALFD) += signalfd.o
28obj-$(CONFIG_TIMERFD) += timerfd.o 28obj-$(CONFIG_TIMERFD) += timerfd.o
29obj-$(CONFIG_EVENTFD) += eventfd.o 29obj-$(CONFIG_EVENTFD) += eventfd.o
30obj-$(CONFIG_FILE_LOCKING) += locks.o
30obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o 31obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
31 32
32nfsd-$(CONFIG_NFSD) := nfsctl.o 33nfsd-$(CONFIG_NFSD) := nfsctl.o
diff --git a/fs/lockd/Makefile b/fs/lockd/Makefile
index 7725a0a9a555..97f6073ab339 100644
--- a/fs/lockd/Makefile
+++ b/fs/lockd/Makefile
@@ -5,6 +5,6 @@
5obj-$(CONFIG_LOCKD) += lockd.o 5obj-$(CONFIG_LOCKD) += lockd.o
6 6
7lockd-objs-y := clntlock.o clntproc.o host.o svc.o svclock.o svcshare.o \ 7lockd-objs-y := clntlock.o clntproc.o host.o svc.o svclock.o svcshare.o \
8 svcproc.o svcsubs.o mon.o xdr.o 8 svcproc.o svcsubs.o mon.o xdr.o grace.o
9lockd-objs-$(CONFIG_LOCKD_V4) += xdr4.o svc4proc.o 9lockd-objs-$(CONFIG_LOCKD_V4) += xdr4.o svc4proc.o
10lockd-objs := $(lockd-objs-y) 10lockd-objs := $(lockd-objs-y)
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 0b45fd3a4bfd..8307dd64bf46 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -54,14 +54,13 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init)
54 u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4; 54 u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4;
55 int status; 55 int status;
56 56
57 status = lockd_up(nlm_init->protocol); 57 status = lockd_up();
58 if (status < 0) 58 if (status < 0)
59 return ERR_PTR(status); 59 return ERR_PTR(status);
60 60
61 host = nlmclnt_lookup_host((struct sockaddr_in *)nlm_init->address, 61 host = nlmclnt_lookup_host(nlm_init->address, nlm_init->addrlen,
62 nlm_init->protocol, nlm_version, 62 nlm_init->protocol, nlm_version,
63 nlm_init->hostname, 63 nlm_init->hostname);
64 strlen(nlm_init->hostname));
65 if (host == NULL) { 64 if (host == NULL) {
66 lockd_down(); 65 lockd_down();
67 return ERR_PTR(-ENOLCK); 66 return ERR_PTR(-ENOLCK);
@@ -142,7 +141,7 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
142/* 141/*
143 * The server lockd has called us back to tell us the lock was granted 142 * The server lockd has called us back to tell us the lock was granted
144 */ 143 */
145__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock) 144__be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock)
146{ 145{
147 const struct file_lock *fl = &lock->fl; 146 const struct file_lock *fl = &lock->fl;
148 const struct nfs_fh *fh = &lock->fh; 147 const struct nfs_fh *fh = &lock->fh;
@@ -166,7 +165,7 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock
166 */ 165 */
167 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid) 166 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid)
168 continue; 167 continue;
169 if (!nlm_cmp_addr(&block->b_host->h_addr, addr)) 168 if (!nlm_cmp_addr(nlm_addr(block->b_host), addr))
170 continue; 169 continue;
171 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0) 170 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
172 continue; 171 continue;
@@ -216,7 +215,7 @@ reclaimer(void *ptr)
216 /* This one ensures that our parent doesn't terminate while the 215 /* This one ensures that our parent doesn't terminate while the
217 * reclaim is in progress */ 216 * reclaim is in progress */
218 lock_kernel(); 217 lock_kernel();
219 lockd_up(0); /* note: this cannot fail as lockd is already running */ 218 lockd_up(); /* note: this cannot fail as lockd is already running */
220 219
221 dprintk("lockd: reclaiming locks for host %s\n", host->h_name); 220 dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
222 221
diff --git a/fs/lockd/grace.c b/fs/lockd/grace.c
new file mode 100644
index 000000000000..183cc1f0af1c
--- /dev/null
+++ b/fs/lockd/grace.c
@@ -0,0 +1,59 @@
1/*
2 * Common code for control of lockd and nfsv4 grace periods.
3 */
4
5#include <linux/module.h>
6#include <linux/lockd/bind.h>
7
8static LIST_HEAD(grace_list);
9static DEFINE_SPINLOCK(grace_lock);
10
11/**
12 * locks_start_grace
13 * @lm: who this grace period is for
14 *
15 * A grace period is a period during which locks should not be given
16 * out. Currently grace periods are only enforced by the two lock
17 * managers (lockd and nfsd), using the locks_in_grace() function to
18 * check when they are in a grace period.
19 *
20 * This function is called to start a grace period.
21 */
22void locks_start_grace(struct lock_manager *lm)
23{
24 spin_lock(&grace_lock);
25 list_add(&lm->list, &grace_list);
26 spin_unlock(&grace_lock);
27}
28EXPORT_SYMBOL_GPL(locks_start_grace);
29
30/**
31 * locks_end_grace
32 * @lm: who this grace period is for
33 *
34 * Call this function to state that the given lock manager is ready to
35 * resume regular locking. The grace period will not end until all lock
36 * managers that called locks_start_grace() also call locks_end_grace().
37 * Note that callers count on it being safe to call this more than once,
38 * and the second call should be a no-op.
39 */
40void locks_end_grace(struct lock_manager *lm)
41{
42 spin_lock(&grace_lock);
43 list_del_init(&lm->list);
44 spin_unlock(&grace_lock);
45}
46EXPORT_SYMBOL_GPL(locks_end_grace);
47
48/**
49 * locks_in_grace
50 *
51 * Lock managers call this function to determine when it is OK for them
52 * to answer ordinary lock requests, and when they should accept only
53 * lock reclaims.
54 */
55int locks_in_grace(void)
56{
57 return !list_empty(&grace_list);
58}
59EXPORT_SYMBOL_GPL(locks_in_grace);
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index a17664c7eacc..9fd8889097b7 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -11,16 +11,17 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h>
14#include <linux/sunrpc/clnt.h> 15#include <linux/sunrpc/clnt.h>
15#include <linux/sunrpc/svc.h> 16#include <linux/sunrpc/svc.h>
16#include <linux/lockd/lockd.h> 17#include <linux/lockd/lockd.h>
17#include <linux/lockd/sm_inter.h> 18#include <linux/lockd/sm_inter.h>
18#include <linux/mutex.h> 19#include <linux/mutex.h>
19 20
21#include <net/ipv6.h>
20 22
21#define NLMDBG_FACILITY NLMDBG_HOSTCACHE 23#define NLMDBG_FACILITY NLMDBG_HOSTCACHE
22#define NLM_HOST_NRHASH 32 24#define NLM_HOST_NRHASH 32
23#define NLM_ADDRHASH(addr) (ntohl(addr) & (NLM_HOST_NRHASH-1))
24#define NLM_HOST_REBIND (60 * HZ) 25#define NLM_HOST_REBIND (60 * HZ)
25#define NLM_HOST_EXPIRE (300 * HZ) 26#define NLM_HOST_EXPIRE (300 * HZ)
26#define NLM_HOST_COLLECT (120 * HZ) 27#define NLM_HOST_COLLECT (120 * HZ)
@@ -30,42 +31,115 @@ static unsigned long next_gc;
30static int nrhosts; 31static int nrhosts;
31static DEFINE_MUTEX(nlm_host_mutex); 32static DEFINE_MUTEX(nlm_host_mutex);
32 33
33
34static void nlm_gc_hosts(void); 34static void nlm_gc_hosts(void);
35static struct nsm_handle * __nsm_find(const struct sockaddr_in *, 35static struct nsm_handle *nsm_find(const struct sockaddr *sap,
36 const char *, unsigned int, int); 36 const size_t salen,
37static struct nsm_handle * nsm_find(const struct sockaddr_in *sin, 37 const char *hostname,
38 const char *hostname, 38 const size_t hostname_len,
39 unsigned int hostname_len); 39 const int create);
40
41struct nlm_lookup_host_info {
42 const int server; /* search for server|client */
43 const struct sockaddr *sap; /* address to search for */
44 const size_t salen; /* it's length */
45 const unsigned short protocol; /* transport to search for*/
46 const u32 version; /* NLM version to search for */
47 const char *hostname; /* remote's hostname */
48 const size_t hostname_len; /* it's length */
49 const struct sockaddr *src_sap; /* our address (optional) */
50 const size_t src_len; /* it's length */
51};
52
53/*
54 * Hash function must work well on big- and little-endian platforms
55 */
56static unsigned int __nlm_hash32(const __be32 n)
57{
58 unsigned int hash = (__force u32)n ^ ((__force u32)n >> 16);
59 return hash ^ (hash >> 8);
60}
61
62static unsigned int __nlm_hash_addr4(const struct sockaddr *sap)
63{
64 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
65 return __nlm_hash32(sin->sin_addr.s_addr);
66}
67
68static unsigned int __nlm_hash_addr6(const struct sockaddr *sap)
69{
70 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
71 const struct in6_addr addr = sin6->sin6_addr;
72 return __nlm_hash32(addr.s6_addr32[0]) ^
73 __nlm_hash32(addr.s6_addr32[1]) ^
74 __nlm_hash32(addr.s6_addr32[2]) ^
75 __nlm_hash32(addr.s6_addr32[3]);
76}
77
78static unsigned int nlm_hash_address(const struct sockaddr *sap)
79{
80 unsigned int hash;
81
82 switch (sap->sa_family) {
83 case AF_INET:
84 hash = __nlm_hash_addr4(sap);
85 break;
86 case AF_INET6:
87 hash = __nlm_hash_addr6(sap);
88 break;
89 default:
90 hash = 0;
91 }
92 return hash & (NLM_HOST_NRHASH - 1);
93}
94
95static void nlm_clear_port(struct sockaddr *sap)
96{
97 switch (sap->sa_family) {
98 case AF_INET:
99 ((struct sockaddr_in *)sap)->sin_port = 0;
100 break;
101 case AF_INET6:
102 ((struct sockaddr_in6 *)sap)->sin6_port = 0;
103 break;
104 }
105}
106
107static void nlm_display_address(const struct sockaddr *sap,
108 char *buf, const size_t len)
109{
110 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
111 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
112
113 switch (sap->sa_family) {
114 case AF_UNSPEC:
115 snprintf(buf, len, "unspecified");
116 break;
117 case AF_INET:
118 snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
119 break;
120 case AF_INET6:
121 if (ipv6_addr_v4mapped(&sin6->sin6_addr))
122 snprintf(buf, len, NIPQUAD_FMT,
123 NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
124 else
125 snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr));
126 break;
127 default:
128 snprintf(buf, len, "unsupported address family");
129 break;
130 }
131}
40 132
41/* 133/*
42 * Common host lookup routine for server & client 134 * Common host lookup routine for server & client
43 */ 135 */
44static struct nlm_host *nlm_lookup_host(int server, 136static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
45 const struct sockaddr_in *sin,
46 int proto, u32 version,
47 const char *hostname,
48 unsigned int hostname_len,
49 const struct sockaddr_in *ssin)
50{ 137{
51 struct hlist_head *chain; 138 struct hlist_head *chain;
52 struct hlist_node *pos; 139 struct hlist_node *pos;
53 struct nlm_host *host; 140 struct nlm_host *host;
54 struct nsm_handle *nsm = NULL; 141 struct nsm_handle *nsm = NULL;
55 int hash;
56
57 dprintk("lockd: nlm_lookup_host("NIPQUAD_FMT"->"NIPQUAD_FMT
58 ", p=%d, v=%u, my role=%s, name=%.*s)\n",
59 NIPQUAD(ssin->sin_addr.s_addr),
60 NIPQUAD(sin->sin_addr.s_addr), proto, version,
61 server? "server" : "client",
62 hostname_len,
63 hostname? hostname : "<none>");
64 142
65
66 hash = NLM_ADDRHASH(sin->sin_addr.s_addr);
67
68 /* Lock hash table */
69 mutex_lock(&nlm_host_mutex); 143 mutex_lock(&nlm_host_mutex);
70 144
71 if (time_after_eq(jiffies, next_gc)) 145 if (time_after_eq(jiffies, next_gc))
@@ -78,22 +152,22 @@ static struct nlm_host *nlm_lookup_host(int server,
78 * different NLM rpc_clients into one single nlm_host object. 152 * different NLM rpc_clients into one single nlm_host object.
79 * This would allow us to have one nlm_host per address. 153 * This would allow us to have one nlm_host per address.
80 */ 154 */
81 chain = &nlm_hosts[hash]; 155 chain = &nlm_hosts[nlm_hash_address(ni->sap)];
82 hlist_for_each_entry(host, pos, chain, h_hash) { 156 hlist_for_each_entry(host, pos, chain, h_hash) {
83 if (!nlm_cmp_addr(&host->h_addr, sin)) 157 if (!nlm_cmp_addr(nlm_addr(host), ni->sap))
84 continue; 158 continue;
85 159
86 /* See if we have an NSM handle for this client */ 160 /* See if we have an NSM handle for this client */
87 if (!nsm) 161 if (!nsm)
88 nsm = host->h_nsmhandle; 162 nsm = host->h_nsmhandle;
89 163
90 if (host->h_proto != proto) 164 if (host->h_proto != ni->protocol)
91 continue; 165 continue;
92 if (host->h_version != version) 166 if (host->h_version != ni->version)
93 continue; 167 continue;
94 if (host->h_server != server) 168 if (host->h_server != ni->server)
95 continue; 169 continue;
96 if (!nlm_cmp_addr(&host->h_saddr, ssin)) 170 if (!nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))
97 continue; 171 continue;
98 172
99 /* Move to head of hash chain. */ 173 /* Move to head of hash chain. */
@@ -101,30 +175,41 @@ static struct nlm_host *nlm_lookup_host(int server,
101 hlist_add_head(&host->h_hash, chain); 175 hlist_add_head(&host->h_hash, chain);
102 176
103 nlm_get_host(host); 177 nlm_get_host(host);
178 dprintk("lockd: nlm_lookup_host found host %s (%s)\n",
179 host->h_name, host->h_addrbuf);
104 goto out; 180 goto out;
105 } 181 }
106 if (nsm)
107 atomic_inc(&nsm->sm_count);
108
109 host = NULL;
110 182
111 /* Sadly, the host isn't in our hash table yet. See if 183 /*
112 * we have an NSM handle for it. If not, create one. 184 * The host wasn't in our hash table. If we don't
185 * have an NSM handle for it yet, create one.
113 */ 186 */
114 if (!nsm && !(nsm = nsm_find(sin, hostname, hostname_len))) 187 if (nsm)
115 goto out; 188 atomic_inc(&nsm->sm_count);
189 else {
190 host = NULL;
191 nsm = nsm_find(ni->sap, ni->salen,
192 ni->hostname, ni->hostname_len, 1);
193 if (!nsm) {
194 dprintk("lockd: nlm_lookup_host failed; "
195 "no nsm handle\n");
196 goto out;
197 }
198 }
116 199
117 host = kzalloc(sizeof(*host), GFP_KERNEL); 200 host = kzalloc(sizeof(*host), GFP_KERNEL);
118 if (!host) { 201 if (!host) {
119 nsm_release(nsm); 202 nsm_release(nsm);
203 dprintk("lockd: nlm_lookup_host failed; no memory\n");
120 goto out; 204 goto out;
121 } 205 }
122 host->h_name = nsm->sm_name; 206 host->h_name = nsm->sm_name;
123 host->h_addr = *sin; 207 memcpy(nlm_addr(host), ni->sap, ni->salen);
124 host->h_addr.sin_port = 0; /* ouch! */ 208 host->h_addrlen = ni->salen;
125 host->h_saddr = *ssin; 209 nlm_clear_port(nlm_addr(host));
126 host->h_version = version; 210 memcpy(nlm_srcaddr(host), ni->src_sap, ni->src_len);
127 host->h_proto = proto; 211 host->h_version = ni->version;
212 host->h_proto = ni->protocol;
128 host->h_rpcclnt = NULL; 213 host->h_rpcclnt = NULL;
129 mutex_init(&host->h_mutex); 214 mutex_init(&host->h_mutex);
130 host->h_nextrebind = jiffies + NLM_HOST_REBIND; 215 host->h_nextrebind = jiffies + NLM_HOST_REBIND;
@@ -135,7 +220,7 @@ static struct nlm_host *nlm_lookup_host(int server,
135 host->h_state = 0; /* pseudo NSM state */ 220 host->h_state = 0; /* pseudo NSM state */
136 host->h_nsmstate = 0; /* real NSM state */ 221 host->h_nsmstate = 0; /* real NSM state */
137 host->h_nsmhandle = nsm; 222 host->h_nsmhandle = nsm;
138 host->h_server = server; 223 host->h_server = ni->server;
139 hlist_add_head(&host->h_hash, chain); 224 hlist_add_head(&host->h_hash, chain);
140 INIT_LIST_HEAD(&host->h_lockowners); 225 INIT_LIST_HEAD(&host->h_lockowners);
141 spin_lock_init(&host->h_lock); 226 spin_lock_init(&host->h_lock);
@@ -143,6 +228,15 @@ static struct nlm_host *nlm_lookup_host(int server,
143 INIT_LIST_HEAD(&host->h_reclaim); 228 INIT_LIST_HEAD(&host->h_reclaim);
144 229
145 nrhosts++; 230 nrhosts++;
231
232 nlm_display_address((struct sockaddr *)&host->h_addr,
233 host->h_addrbuf, sizeof(host->h_addrbuf));
234 nlm_display_address((struct sockaddr *)&host->h_srcaddr,
235 host->h_srcaddrbuf, sizeof(host->h_srcaddrbuf));
236
237 dprintk("lockd: nlm_lookup_host created host %s\n",
238 host->h_name);
239
146out: 240out:
147 mutex_unlock(&nlm_host_mutex); 241 mutex_unlock(&nlm_host_mutex);
148 return host; 242 return host;
@@ -170,33 +264,103 @@ nlm_destroy_host(struct nlm_host *host)
170 kfree(host); 264 kfree(host);
171} 265}
172 266
173/* 267/**
174 * Find an NLM server handle in the cache. If there is none, create it. 268 * nlmclnt_lookup_host - Find an NLM host handle matching a remote server
269 * @sap: network address of server
270 * @salen: length of server address
271 * @protocol: transport protocol to use
272 * @version: NLM protocol version
273 * @hostname: '\0'-terminated hostname of server
274 *
275 * Returns an nlm_host structure that matches the passed-in
276 * [server address, transport protocol, NLM version, server hostname].
277 * If one doesn't already exist in the host cache, a new handle is
278 * created and returned.
175 */ 279 */
176struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, 280struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
177 int proto, u32 version, 281 const size_t salen,
178 const char *hostname, 282 const unsigned short protocol,
179 unsigned int hostname_len) 283 const u32 version, const char *hostname)
180{ 284{
181 struct sockaddr_in ssin = {0}; 285 const struct sockaddr source = {
182 286 .sa_family = AF_UNSPEC,
183 return nlm_lookup_host(0, sin, proto, version, 287 };
184 hostname, hostname_len, &ssin); 288 struct nlm_lookup_host_info ni = {
289 .server = 0,
290 .sap = sap,
291 .salen = salen,
292 .protocol = protocol,
293 .version = version,
294 .hostname = hostname,
295 .hostname_len = strlen(hostname),
296 .src_sap = &source,
297 .src_len = sizeof(source),
298 };
299
300 dprintk("lockd: %s(host='%s', vers=%u, proto=%s)\n", __func__,
301 (hostname ? hostname : "<none>"), version,
302 (protocol == IPPROTO_UDP ? "udp" : "tcp"));
303
304 return nlm_lookup_host(&ni);
185} 305}
186 306
187/* 307/**
188 * Find an NLM client handle in the cache. If there is none, create it. 308 * nlmsvc_lookup_host - Find an NLM host handle matching a remote client
309 * @rqstp: incoming NLM request
310 * @hostname: name of client host
311 * @hostname_len: length of client hostname
312 *
313 * Returns an nlm_host structure that matches the [client address,
314 * transport protocol, NLM version, client hostname] of the passed-in
315 * NLM request. If one doesn't already exist in the host cache, a
316 * new handle is created and returned.
317 *
318 * Before possibly creating a new nlm_host, construct a sockaddr
319 * for a specific source address in case the local system has
320 * multiple network addresses. The family of the address in
321 * rq_daddr is guaranteed to be the same as the family of the
322 * address in rq_addr, so it's safe to use the same family for
323 * the source address.
189 */ 324 */
190struct nlm_host * 325struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
191nlmsvc_lookup_host(struct svc_rqst *rqstp, 326 const char *hostname,
192 const char *hostname, unsigned int hostname_len) 327 const size_t hostname_len)
193{ 328{
194 struct sockaddr_in ssin = {0}; 329 struct sockaddr_in sin = {
330 .sin_family = AF_INET,
331 };
332 struct sockaddr_in6 sin6 = {
333 .sin6_family = AF_INET6,
334 };
335 struct nlm_lookup_host_info ni = {
336 .server = 1,
337 .sap = svc_addr(rqstp),
338 .salen = rqstp->rq_addrlen,
339 .protocol = rqstp->rq_prot,
340 .version = rqstp->rq_vers,
341 .hostname = hostname,
342 .hostname_len = hostname_len,
343 .src_len = rqstp->rq_addrlen,
344 };
345
346 dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__,
347 (int)hostname_len, hostname, rqstp->rq_vers,
348 (rqstp->rq_prot == IPPROTO_UDP ? "udp" : "tcp"));
349
350 switch (ni.sap->sa_family) {
351 case AF_INET:
352 sin.sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr;
353 ni.src_sap = (struct sockaddr *)&sin;
354 break;
355 case AF_INET6:
356 ipv6_addr_copy(&sin6.sin6_addr, &rqstp->rq_daddr.addr6);
357 ni.src_sap = (struct sockaddr *)&sin6;
358 break;
359 default:
360 return NULL;
361 }
195 362
196 ssin.sin_addr = rqstp->rq_daddr.addr; 363 return nlm_lookup_host(&ni);
197 return nlm_lookup_host(1, svc_addr_in(rqstp),
198 rqstp->rq_prot, rqstp->rq_vers,
199 hostname, hostname_len, &ssin);
200} 364}
201 365
202/* 366/*
@@ -207,9 +371,8 @@ nlm_bind_host(struct nlm_host *host)
207{ 371{
208 struct rpc_clnt *clnt; 372 struct rpc_clnt *clnt;
209 373
210 dprintk("lockd: nlm_bind_host("NIPQUAD_FMT"->"NIPQUAD_FMT")\n", 374 dprintk("lockd: nlm_bind_host %s (%s), my addr=%s\n",
211 NIPQUAD(host->h_saddr.sin_addr), 375 host->h_name, host->h_addrbuf, host->h_srcaddrbuf);
212 NIPQUAD(host->h_addr.sin_addr));
213 376
214 /* Lock host handle */ 377 /* Lock host handle */
215 mutex_lock(&host->h_mutex); 378 mutex_lock(&host->h_mutex);
@@ -221,7 +384,7 @@ nlm_bind_host(struct nlm_host *host)
221 if (time_after_eq(jiffies, host->h_nextrebind)) { 384 if (time_after_eq(jiffies, host->h_nextrebind)) {
222 rpc_force_rebind(clnt); 385 rpc_force_rebind(clnt);
223 host->h_nextrebind = jiffies + NLM_HOST_REBIND; 386 host->h_nextrebind = jiffies + NLM_HOST_REBIND;
224 dprintk("lockd: next rebind in %ld jiffies\n", 387 dprintk("lockd: next rebind in %lu jiffies\n",
225 host->h_nextrebind - jiffies); 388 host->h_nextrebind - jiffies);
226 } 389 }
227 } else { 390 } else {
@@ -234,9 +397,9 @@ nlm_bind_host(struct nlm_host *host)
234 }; 397 };
235 struct rpc_create_args args = { 398 struct rpc_create_args args = {
236 .protocol = host->h_proto, 399 .protocol = host->h_proto,
237 .address = (struct sockaddr *)&host->h_addr, 400 .address = nlm_addr(host),
238 .addrsize = sizeof(host->h_addr), 401 .addrsize = host->h_addrlen,
239 .saddress = (struct sockaddr *)&host->h_saddr, 402 .saddress = nlm_srcaddr(host),
240 .timeout = &timeparms, 403 .timeout = &timeparms,
241 .servername = host->h_name, 404 .servername = host->h_name,
242 .program = &nlm_program, 405 .program = &nlm_program,
@@ -324,12 +487,16 @@ void nlm_host_rebooted(const struct sockaddr_in *sin,
324 struct nsm_handle *nsm; 487 struct nsm_handle *nsm;
325 struct nlm_host *host; 488 struct nlm_host *host;
326 489
327 dprintk("lockd: nlm_host_rebooted(%s, %u.%u.%u.%u)\n", 490 nsm = nsm_find((struct sockaddr *)sin, sizeof(*sin),
328 hostname, NIPQUAD(sin->sin_addr)); 491 hostname, hostname_len, 0);
329 492 if (nsm == NULL) {
330 /* Find the NSM handle for this peer */ 493 dprintk("lockd: never saw rebooted peer '%.*s' before\n",
331 if (!(nsm = __nsm_find(sin, hostname, hostname_len, 0))) 494 hostname_len, hostname);
332 return; 495 return;
496 }
497
498 dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n",
499 hostname_len, hostname, nsm->sm_addrbuf);
333 500
334 /* When reclaiming locks on this peer, make sure that 501 /* When reclaiming locks on this peer, make sure that
335 * we set up a new notification */ 502 * we set up a new notification */
@@ -461,22 +628,23 @@ nlm_gc_hosts(void)
461static LIST_HEAD(nsm_handles); 628static LIST_HEAD(nsm_handles);
462static DEFINE_SPINLOCK(nsm_lock); 629static DEFINE_SPINLOCK(nsm_lock);
463 630
464static struct nsm_handle * 631static struct nsm_handle *nsm_find(const struct sockaddr *sap,
465__nsm_find(const struct sockaddr_in *sin, 632 const size_t salen,
466 const char *hostname, unsigned int hostname_len, 633 const char *hostname,
467 int create) 634 const size_t hostname_len,
635 const int create)
468{ 636{
469 struct nsm_handle *nsm = NULL; 637 struct nsm_handle *nsm = NULL;
470 struct nsm_handle *pos; 638 struct nsm_handle *pos;
471 639
472 if (!sin) 640 if (!sap)
473 return NULL; 641 return NULL;
474 642
475 if (hostname && memchr(hostname, '/', hostname_len) != NULL) { 643 if (hostname && memchr(hostname, '/', hostname_len) != NULL) {
476 if (printk_ratelimit()) { 644 if (printk_ratelimit()) {
477 printk(KERN_WARNING "Invalid hostname \"%.*s\" " 645 printk(KERN_WARNING "Invalid hostname \"%.*s\" "
478 "in NFS lock request\n", 646 "in NFS lock request\n",
479 hostname_len, hostname); 647 (int)hostname_len, hostname);
480 } 648 }
481 return NULL; 649 return NULL;
482 } 650 }
@@ -489,7 +657,7 @@ retry:
489 if (strlen(pos->sm_name) != hostname_len 657 if (strlen(pos->sm_name) != hostname_len
490 || memcmp(pos->sm_name, hostname, hostname_len)) 658 || memcmp(pos->sm_name, hostname, hostname_len))
491 continue; 659 continue;
492 } else if (!nlm_cmp_addr(&pos->sm_addr, sin)) 660 } else if (!nlm_cmp_addr(nsm_addr(pos), sap))
493 continue; 661 continue;
494 atomic_inc(&pos->sm_count); 662 atomic_inc(&pos->sm_count);
495 kfree(nsm); 663 kfree(nsm);
@@ -509,10 +677,13 @@ retry:
509 if (nsm == NULL) 677 if (nsm == NULL)
510 return NULL; 678 return NULL;
511 679
512 nsm->sm_addr = *sin; 680 memcpy(nsm_addr(nsm), sap, salen);
681 nsm->sm_addrlen = salen;
513 nsm->sm_name = (char *) (nsm + 1); 682 nsm->sm_name = (char *) (nsm + 1);
514 memcpy(nsm->sm_name, hostname, hostname_len); 683 memcpy(nsm->sm_name, hostname, hostname_len);
515 nsm->sm_name[hostname_len] = '\0'; 684 nsm->sm_name[hostname_len] = '\0';
685 nlm_display_address((struct sockaddr *)&nsm->sm_addr,
686 nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf));
516 atomic_set(&nsm->sm_count, 1); 687 atomic_set(&nsm->sm_count, 1);
517 goto retry; 688 goto retry;
518 689
@@ -521,13 +692,6 @@ found:
521 return nsm; 692 return nsm;
522} 693}
523 694
524static struct nsm_handle *
525nsm_find(const struct sockaddr_in *sin, const char *hostname,
526 unsigned int hostname_len)
527{
528 return __nsm_find(sin, hostname, hostname_len, 1);
529}
530
531/* 695/*
532 * Release an NSM handle 696 * Release an NSM handle
533 */ 697 */
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index e4d563543b11..4e7e958e8f67 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -51,7 +51,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
51 51
52 memset(&args, 0, sizeof(args)); 52 memset(&args, 0, sizeof(args));
53 args.mon_name = nsm->sm_name; 53 args.mon_name = nsm->sm_name;
54 args.addr = nsm->sm_addr.sin_addr.s_addr; 54 args.addr = nsm_addr_in(nsm)->sin_addr.s_addr;
55 args.prog = NLM_PROGRAM; 55 args.prog = NLM_PROGRAM;
56 args.vers = 3; 56 args.vers = 3;
57 args.proc = NLMPROC_NSM_NOTIFY; 57 args.proc = NLMPROC_NSM_NOTIFY;
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 5bd9bf0fa9df..c631a83931ce 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -51,7 +51,6 @@ static DEFINE_MUTEX(nlmsvc_mutex);
51static unsigned int nlmsvc_users; 51static unsigned int nlmsvc_users;
52static struct task_struct *nlmsvc_task; 52static struct task_struct *nlmsvc_task;
53static struct svc_rqst *nlmsvc_rqst; 53static struct svc_rqst *nlmsvc_rqst;
54int nlmsvc_grace_period;
55unsigned long nlmsvc_timeout; 54unsigned long nlmsvc_timeout;
56 55
57/* 56/*
@@ -85,27 +84,23 @@ static unsigned long get_lockd_grace_period(void)
85 return nlm_timeout * 5 * HZ; 84 return nlm_timeout * 5 * HZ;
86} 85}
87 86
88unsigned long get_nfs_grace_period(void) 87static struct lock_manager lockd_manager = {
89{ 88};
90 unsigned long lockdgrace = get_lockd_grace_period();
91 unsigned long nfsdgrace = 0;
92
93 if (nlmsvc_ops)
94 nfsdgrace = nlmsvc_ops->get_grace_period();
95
96 return max(lockdgrace, nfsdgrace);
97}
98EXPORT_SYMBOL(get_nfs_grace_period);
99 89
100static unsigned long set_grace_period(void) 90static void grace_ender(struct work_struct *not_used)
101{ 91{
102 nlmsvc_grace_period = 1; 92 locks_end_grace(&lockd_manager);
103 return get_nfs_grace_period() + jiffies;
104} 93}
105 94
106static inline void clear_grace_period(void) 95static DECLARE_DELAYED_WORK(grace_period_end, grace_ender);
96
97static void set_grace_period(void)
107{ 98{
108 nlmsvc_grace_period = 0; 99 unsigned long grace_period = get_lockd_grace_period();
100
101 locks_start_grace(&lockd_manager);
102 cancel_delayed_work_sync(&grace_period_end);
103 schedule_delayed_work(&grace_period_end, grace_period);
109} 104}
110 105
111/* 106/*
@@ -116,7 +111,6 @@ lockd(void *vrqstp)
116{ 111{
117 int err = 0, preverr = 0; 112 int err = 0, preverr = 0;
118 struct svc_rqst *rqstp = vrqstp; 113 struct svc_rqst *rqstp = vrqstp;
119 unsigned long grace_period_expire;
120 114
121 /* try_to_freeze() is called from svc_recv() */ 115 /* try_to_freeze() is called from svc_recv() */
122 set_freezable(); 116 set_freezable();
@@ -139,7 +133,7 @@ lockd(void *vrqstp)
139 nlm_timeout = LOCKD_DFLT_TIMEO; 133 nlm_timeout = LOCKD_DFLT_TIMEO;
140 nlmsvc_timeout = nlm_timeout * HZ; 134 nlmsvc_timeout = nlm_timeout * HZ;
141 135
142 grace_period_expire = set_grace_period(); 136 set_grace_period();
143 137
144 /* 138 /*
145 * The main request loop. We don't terminate until the last 139 * The main request loop. We don't terminate until the last
@@ -153,21 +147,12 @@ lockd(void *vrqstp)
153 flush_signals(current); 147 flush_signals(current);
154 if (nlmsvc_ops) { 148 if (nlmsvc_ops) {
155 nlmsvc_invalidate_all(); 149 nlmsvc_invalidate_all();
156 grace_period_expire = set_grace_period(); 150 set_grace_period();
157 } 151 }
158 continue; 152 continue;
159 } 153 }
160 154
161 /* 155 timeout = nlmsvc_retry_blocked();
162 * Retry any blocked locks that have been notified by
163 * the VFS. Don't do this during grace period.
164 * (Theoretically, there shouldn't even be blocked locks
165 * during grace period).
166 */
167 if (!nlmsvc_grace_period) {
168 timeout = nlmsvc_retry_blocked();
169 } else if (time_before(grace_period_expire, jiffies))
170 clear_grace_period();
171 156
172 /* 157 /*
173 * Find a socket with data available and call its 158 * Find a socket with data available and call its
@@ -195,6 +180,7 @@ lockd(void *vrqstp)
195 svc_process(rqstp); 180 svc_process(rqstp);
196 } 181 }
197 flush_signals(current); 182 flush_signals(current);
183 cancel_delayed_work_sync(&grace_period_end);
198 if (nlmsvc_ops) 184 if (nlmsvc_ops)
199 nlmsvc_invalidate_all(); 185 nlmsvc_invalidate_all();
200 nlm_shutdown_hosts(); 186 nlm_shutdown_hosts();
@@ -203,25 +189,28 @@ lockd(void *vrqstp)
203} 189}
204 190
205/* 191/*
206 * Make any sockets that are needed but not present. 192 * Ensure there are active UDP and TCP listeners for lockd.
207 * If nlm_udpport or nlm_tcpport were set as module 193 *
208 * options, make those sockets unconditionally 194 * Even if we have only TCP NFS mounts and/or TCP NFSDs, some
195 * local services (such as rpc.statd) still require UDP, and
196 * some NFS servers do not yet support NLM over TCP.
197 *
198 * Returns zero if all listeners are available; otherwise a
199 * negative errno value is returned.
209 */ 200 */
210static int make_socks(struct svc_serv *serv, int proto) 201static int make_socks(struct svc_serv *serv)
211{ 202{
212 static int warned; 203 static int warned;
213 struct svc_xprt *xprt; 204 struct svc_xprt *xprt;
214 int err = 0; 205 int err = 0;
215 206
216 if (proto == IPPROTO_UDP || nlm_udpport) { 207 xprt = svc_find_xprt(serv, "udp", 0, 0);
217 xprt = svc_find_xprt(serv, "udp", 0, 0); 208 if (!xprt)
218 if (!xprt) 209 err = svc_create_xprt(serv, "udp", nlm_udpport,
219 err = svc_create_xprt(serv, "udp", nlm_udpport, 210 SVC_SOCK_DEFAULTS);
220 SVC_SOCK_DEFAULTS); 211 else
221 else 212 svc_xprt_put(xprt);
222 svc_xprt_put(xprt); 213 if (err >= 0) {
223 }
224 if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
225 xprt = svc_find_xprt(serv, "tcp", 0, 0); 214 xprt = svc_find_xprt(serv, "tcp", 0, 0);
226 if (!xprt) 215 if (!xprt)
227 err = svc_create_xprt(serv, "tcp", nlm_tcpport, 216 err = svc_create_xprt(serv, "tcp", nlm_tcpport,
@@ -241,8 +230,7 @@ static int make_socks(struct svc_serv *serv, int proto)
241/* 230/*
242 * Bring up the lockd process if it's not already up. 231 * Bring up the lockd process if it's not already up.
243 */ 232 */
244int 233int lockd_up(void)
245lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
246{ 234{
247 struct svc_serv *serv; 235 struct svc_serv *serv;
248 int error = 0; 236 int error = 0;
@@ -251,11 +239,8 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
251 /* 239 /*
252 * Check whether we're already up and running. 240 * Check whether we're already up and running.
253 */ 241 */
254 if (nlmsvc_rqst) { 242 if (nlmsvc_rqst)
255 if (proto)
256 error = make_socks(nlmsvc_rqst->rq_server, proto);
257 goto out; 243 goto out;
258 }
259 244
260 /* 245 /*
261 * Sanity check: if there's no pid, 246 * Sanity check: if there's no pid,
@@ -266,13 +251,14 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
266 "lockd_up: no pid, %d users??\n", nlmsvc_users); 251 "lockd_up: no pid, %d users??\n", nlmsvc_users);
267 252
268 error = -ENOMEM; 253 error = -ENOMEM;
269 serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); 254 serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, AF_INET, NULL);
270 if (!serv) { 255 if (!serv) {
271 printk(KERN_WARNING "lockd_up: create service failed\n"); 256 printk(KERN_WARNING "lockd_up: create service failed\n");
272 goto out; 257 goto out;
273 } 258 }
274 259
275 if ((error = make_socks(serv, proto)) < 0) 260 error = make_socks(serv);
261 if (error < 0)
276 goto destroy_and_out; 262 goto destroy_and_out;
277 263
278 /* 264 /*
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 4a714f64515b..014f6ce48172 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -88,12 +88,6 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
88 dprintk("lockd: TEST4 called\n"); 88 dprintk("lockd: TEST4 called\n");
89 resp->cookie = argp->cookie; 89 resp->cookie = argp->cookie;
90 90
91 /* Don't accept test requests during grace period */
92 if (nlmsvc_grace_period) {
93 resp->status = nlm_lck_denied_grace_period;
94 return rc;
95 }
96
97 /* Obtain client and file */ 91 /* Obtain client and file */
98 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 92 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
99 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 93 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
@@ -122,12 +116,6 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
122 116
123 resp->cookie = argp->cookie; 117 resp->cookie = argp->cookie;
124 118
125 /* Don't accept new lock requests during grace period */
126 if (nlmsvc_grace_period && !argp->reclaim) {
127 resp->status = nlm_lck_denied_grace_period;
128 return rc;
129 }
130
131 /* Obtain client and file */ 119 /* Obtain client and file */
132 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 120 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
133 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 121 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
@@ -146,7 +134,8 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
146 134
147 /* Now try to lock the file */ 135 /* Now try to lock the file */
148 resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, 136 resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
149 argp->block, &argp->cookie); 137 argp->block, &argp->cookie,
138 argp->reclaim);
150 if (resp->status == nlm_drop_reply) 139 if (resp->status == nlm_drop_reply)
151 rc = rpc_drop_reply; 140 rc = rpc_drop_reply;
152 else 141 else
@@ -169,7 +158,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
169 resp->cookie = argp->cookie; 158 resp->cookie = argp->cookie;
170 159
171 /* Don't accept requests during grace period */ 160 /* Don't accept requests during grace period */
172 if (nlmsvc_grace_period) { 161 if (locks_in_grace()) {
173 resp->status = nlm_lck_denied_grace_period; 162 resp->status = nlm_lck_denied_grace_period;
174 return rpc_success; 163 return rpc_success;
175 } 164 }
@@ -202,7 +191,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
202 resp->cookie = argp->cookie; 191 resp->cookie = argp->cookie;
203 192
204 /* Don't accept new lock requests during grace period */ 193 /* Don't accept new lock requests during grace period */
205 if (nlmsvc_grace_period) { 194 if (locks_in_grace()) {
206 resp->status = nlm_lck_denied_grace_period; 195 resp->status = nlm_lck_denied_grace_period;
207 return rpc_success; 196 return rpc_success;
208 } 197 }
@@ -231,7 +220,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
231 resp->cookie = argp->cookie; 220 resp->cookie = argp->cookie;
232 221
233 dprintk("lockd: GRANTED called\n"); 222 dprintk("lockd: GRANTED called\n");
234 resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock); 223 resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
235 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 224 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
236 return rpc_success; 225 return rpc_success;
237} 226}
@@ -341,7 +330,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
341 resp->cookie = argp->cookie; 330 resp->cookie = argp->cookie;
342 331
343 /* Don't accept new lock requests during grace period */ 332 /* Don't accept new lock requests during grace period */
344 if (nlmsvc_grace_period && !argp->reclaim) { 333 if (locks_in_grace() && !argp->reclaim) {
345 resp->status = nlm_lck_denied_grace_period; 334 resp->status = nlm_lck_denied_grace_period;
346 return rpc_success; 335 return rpc_success;
347 } 336 }
@@ -374,7 +363,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
374 resp->cookie = argp->cookie; 363 resp->cookie = argp->cookie;
375 364
376 /* Don't accept requests during grace period */ 365 /* Don't accept requests during grace period */
377 if (nlmsvc_grace_period) { 366 if (locks_in_grace()) {
378 resp->status = nlm_lck_denied_grace_period; 367 resp->status = nlm_lck_denied_grace_period;
379 return rpc_success; 368 return rpc_success;
380 } 369 }
@@ -432,11 +421,9 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
432{ 421{
433 struct sockaddr_in saddr; 422 struct sockaddr_in saddr;
434 423
435 memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr));
436
437 dprintk("lockd: SM_NOTIFY called\n"); 424 dprintk("lockd: SM_NOTIFY called\n");
438 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 425
439 || ntohs(saddr.sin_port) >= 1024) { 426 if (!nlm_privileged_requester(rqstp)) {
440 char buf[RPC_MAX_ADDRBUFLEN]; 427 char buf[RPC_MAX_ADDRBUFLEN];
441 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", 428 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
442 svc_print_addr(rqstp, buf, sizeof(buf))); 429 svc_print_addr(rqstp, buf, sizeof(buf)));
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index cf0d5c2c318d..6063a8e4b9f3 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -360,7 +360,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
360__be32 360__be32
361nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, 361nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
362 struct nlm_host *host, struct nlm_lock *lock, int wait, 362 struct nlm_host *host, struct nlm_lock *lock, int wait,
363 struct nlm_cookie *cookie) 363 struct nlm_cookie *cookie, int reclaim)
364{ 364{
365 struct nlm_block *block = NULL; 365 struct nlm_block *block = NULL;
366 int error; 366 int error;
@@ -406,6 +406,15 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
406 goto out; 406 goto out;
407 } 407 }
408 408
409 if (locks_in_grace() && !reclaim) {
410 ret = nlm_lck_denied_grace_period;
411 goto out;
412 }
413 if (reclaim && !locks_in_grace()) {
414 ret = nlm_lck_denied_grace_period;
415 goto out;
416 }
417
409 if (!wait) 418 if (!wait)
410 lock->fl.fl_flags &= ~FL_SLEEP; 419 lock->fl.fl_flags &= ~FL_SLEEP;
411 error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL); 420 error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);
@@ -502,6 +511,10 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
502 goto out; 511 goto out;
503 } 512 }
504 513
514 if (locks_in_grace()) {
515 ret = nlm_lck_denied_grace_period;
516 goto out;
517 }
505 error = vfs_test_lock(file->f_file, &lock->fl); 518 error = vfs_test_lock(file->f_file, &lock->fl);
506 if (error == FILE_LOCK_DEFERRED) { 519 if (error == FILE_LOCK_DEFERRED) {
507 ret = nlmsvc_defer_lock_rqst(rqstp, block); 520 ret = nlmsvc_defer_lock_rqst(rqstp, block);
@@ -582,6 +595,9 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
582 (long long)lock->fl.fl_start, 595 (long long)lock->fl.fl_start,
583 (long long)lock->fl.fl_end); 596 (long long)lock->fl.fl_end);
584 597
598 if (locks_in_grace())
599 return nlm_lck_denied_grace_period;
600
585 mutex_lock(&file->f_mutex); 601 mutex_lock(&file->f_mutex);
586 block = nlmsvc_lookup_block(file, lock); 602 block = nlmsvc_lookup_block(file, lock);
587 mutex_unlock(&file->f_mutex); 603 mutex_unlock(&file->f_mutex);
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 76262c1986f2..548b0bb2b84d 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -117,12 +117,6 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
117 dprintk("lockd: TEST called\n"); 117 dprintk("lockd: TEST called\n");
118 resp->cookie = argp->cookie; 118 resp->cookie = argp->cookie;
119 119
120 /* Don't accept test requests during grace period */
121 if (nlmsvc_grace_period) {
122 resp->status = nlm_lck_denied_grace_period;
123 return rc;
124 }
125
126 /* Obtain client and file */ 120 /* Obtain client and file */
127 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 121 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
128 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 122 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
@@ -152,12 +146,6 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
152 146
153 resp->cookie = argp->cookie; 147 resp->cookie = argp->cookie;
154 148
155 /* Don't accept new lock requests during grace period */
156 if (nlmsvc_grace_period && !argp->reclaim) {
157 resp->status = nlm_lck_denied_grace_period;
158 return rc;
159 }
160
161 /* Obtain client and file */ 149 /* Obtain client and file */
162 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) 150 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
163 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 151 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
@@ -176,7 +164,8 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
176 164
177 /* Now try to lock the file */ 165 /* Now try to lock the file */
178 resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock, 166 resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
179 argp->block, &argp->cookie)); 167 argp->block, &argp->cookie,
168 argp->reclaim));
180 if (resp->status == nlm_drop_reply) 169 if (resp->status == nlm_drop_reply)
181 rc = rpc_drop_reply; 170 rc = rpc_drop_reply;
182 else 171 else
@@ -199,7 +188,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
199 resp->cookie = argp->cookie; 188 resp->cookie = argp->cookie;
200 189
201 /* Don't accept requests during grace period */ 190 /* Don't accept requests during grace period */
202 if (nlmsvc_grace_period) { 191 if (locks_in_grace()) {
203 resp->status = nlm_lck_denied_grace_period; 192 resp->status = nlm_lck_denied_grace_period;
204 return rpc_success; 193 return rpc_success;
205 } 194 }
@@ -232,7 +221,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
232 resp->cookie = argp->cookie; 221 resp->cookie = argp->cookie;
233 222
234 /* Don't accept new lock requests during grace period */ 223 /* Don't accept new lock requests during grace period */
235 if (nlmsvc_grace_period) { 224 if (locks_in_grace()) {
236 resp->status = nlm_lck_denied_grace_period; 225 resp->status = nlm_lck_denied_grace_period;
237 return rpc_success; 226 return rpc_success;
238 } 227 }
@@ -261,7 +250,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
261 resp->cookie = argp->cookie; 250 resp->cookie = argp->cookie;
262 251
263 dprintk("lockd: GRANTED called\n"); 252 dprintk("lockd: GRANTED called\n");
264 resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock); 253 resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
265 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 254 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
266 return rpc_success; 255 return rpc_success;
267} 256}
@@ -373,7 +362,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
373 resp->cookie = argp->cookie; 362 resp->cookie = argp->cookie;
374 363
375 /* Don't accept new lock requests during grace period */ 364 /* Don't accept new lock requests during grace period */
376 if (nlmsvc_grace_period && !argp->reclaim) { 365 if (locks_in_grace() && !argp->reclaim) {
377 resp->status = nlm_lck_denied_grace_period; 366 resp->status = nlm_lck_denied_grace_period;
378 return rpc_success; 367 return rpc_success;
379 } 368 }
@@ -406,7 +395,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
406 resp->cookie = argp->cookie; 395 resp->cookie = argp->cookie;
407 396
408 /* Don't accept requests during grace period */ 397 /* Don't accept requests during grace period */
409 if (nlmsvc_grace_period) { 398 if (locks_in_grace()) {
410 resp->status = nlm_lck_denied_grace_period; 399 resp->status = nlm_lck_denied_grace_period;
411 return rpc_success; 400 return rpc_success;
412 } 401 }
@@ -464,11 +453,9 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
464{ 453{
465 struct sockaddr_in saddr; 454 struct sockaddr_in saddr;
466 455
467 memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr));
468
469 dprintk("lockd: SM_NOTIFY called\n"); 456 dprintk("lockd: SM_NOTIFY called\n");
470 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 457
471 || ntohs(saddr.sin_port) >= 1024) { 458 if (!nlm_privileged_requester(rqstp)) {
472 char buf[RPC_MAX_ADDRBUFLEN]; 459 char buf[RPC_MAX_ADDRBUFLEN];
473 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", 460 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
474 svc_print_addr(rqstp, buf, sizeof(buf))); 461 svc_print_addr(rqstp, buf, sizeof(buf)));
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 198b4e55b373..34c2766e27c7 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -418,7 +418,7 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);
418static int 418static int
419nlmsvc_match_ip(void *datap, struct nlm_host *host) 419nlmsvc_match_ip(void *datap, struct nlm_host *host)
420{ 420{
421 return nlm_cmp_addr(&host->h_saddr, datap); 421 return nlm_cmp_addr(nlm_srcaddr(host), datap);
422} 422}
423 423
424/** 424/**
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 3e459e18cc31..1f226290c67c 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -351,8 +351,6 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
351 argp->state = ntohl(*p++); 351 argp->state = ntohl(*p++);
352 /* Preserve the address in network byte order */ 352 /* Preserve the address in network byte order */
353 argp->addr = *p++; 353 argp->addr = *p++;
354 argp->vers = *p++;
355 argp->proto = *p++;
356 return xdr_argsize_check(rqstp, p); 354 return xdr_argsize_check(rqstp, p);
357} 355}
358 356
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 43ff9397e6c6..50c493a8ad8e 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -358,8 +358,6 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
358 argp->state = ntohl(*p++); 358 argp->state = ntohl(*p++);
359 /* Preserve the address in network byte order */ 359 /* Preserve the address in network byte order */
360 argp->addr = *p++; 360 argp->addr = *p++;
361 argp->vers = *p++;
362 argp->proto = *p++;
363 return xdr_argsize_check(rqstp, p); 361 return xdr_argsize_check(rqstp, p);
364} 362}
365 363
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index f447f4b4476c..6a09760c5960 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -105,7 +105,8 @@ int nfs_callback_up(void)
105 mutex_lock(&nfs_callback_mutex); 105 mutex_lock(&nfs_callback_mutex);
106 if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) 106 if (nfs_callback_info.users++ || nfs_callback_info.task != NULL)
107 goto out; 107 goto out;
108 serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, NULL); 108 serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE,
109 AF_INET, NULL);
109 ret = -ENOMEM; 110 ret = -ENOMEM;
110 if (!serv) 111 if (!serv)
111 goto out_err; 112 goto out_err;
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 15c6faeec77c..b2786a5f9afe 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -70,7 +70,6 @@ nlm_fclose(struct file *filp)
70static struct nlmsvc_binding nfsd_nlm_ops = { 70static struct nlmsvc_binding nfsd_nlm_ops = {
71 .fopen = nlm_fopen, /* open file for locking */ 71 .fopen = nlm_fopen, /* open file for locking */
72 .fclose = nlm_fclose, /* close file */ 72 .fclose = nlm_fclose, /* close file */
73 .get_grace_period = get_nfs4_grace_period,
74}; 73};
75 74
76void 75void
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 4d617ea28cfc..9dbd2eb91281 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -63,7 +63,8 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
63 SVCFH_fmt(&argp->fh)); 63 SVCFH_fmt(&argp->fh));
64 64
65 fh_copy(&resp->fh, &argp->fh); 65 fh_copy(&resp->fh, &argp->fh);
66 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); 66 nfserr = fh_verify(rqstp, &resp->fh, 0,
67 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
67 if (nfserr) 68 if (nfserr)
68 RETURN_STATUS(nfserr); 69 RETURN_STATUS(nfserr);
69 70
@@ -530,7 +531,7 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
530 dprintk("nfsd: FSSTAT(3) %s\n", 531 dprintk("nfsd: FSSTAT(3) %s\n",
531 SVCFH_fmt(&argp->fh)); 532 SVCFH_fmt(&argp->fh));
532 533
533 nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats); 534 nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
534 fh_put(&argp->fh); 535 fh_put(&argp->fh);
535 RETURN_STATUS(nfserr); 536 RETURN_STATUS(nfserr);
536} 537}
@@ -558,7 +559,8 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
558 resp->f_maxfilesize = ~(u32) 0; 559 resp->f_maxfilesize = ~(u32) 0;
559 resp->f_properties = NFS3_FSF_DEFAULT; 560 resp->f_properties = NFS3_FSF_DEFAULT;
560 561
561 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); 562 nfserr = fh_verify(rqstp, &argp->fh, 0,
563 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
562 564
563 /* Check special features of the file system. May request 565 /* Check special features of the file system. May request
564 * different read/write sizes for file systems known to have 566 * different read/write sizes for file systems known to have
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 702fa577aa6e..094747a1227c 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -225,7 +225,8 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
225 225
226 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len); 226 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len);
227 WRITE32(OP_CB_RECALL); 227 WRITE32(OP_CB_RECALL);
228 WRITEMEM(&cb_rec->cbr_stateid, sizeof(stateid_t)); 228 WRITE32(cb_rec->cbr_stateid.si_generation);
229 WRITEMEM(&cb_rec->cbr_stateid.si_opaque, sizeof(stateid_opaque_t));
229 WRITE32(cb_rec->cbr_trunc); 230 WRITE32(cb_rec->cbr_trunc);
230 WRITE32(len); 231 WRITE32(len);
231 WRITEMEM(cb_rec->cbr_fhval, len); 232 WRITEMEM(cb_rec->cbr_fhval, len);
@@ -379,6 +380,7 @@ static int do_probe_callback(void *data)
379 .addrsize = sizeof(addr), 380 .addrsize = sizeof(addr),
380 .timeout = &timeparms, 381 .timeout = &timeparms,
381 .program = &cb_program, 382 .program = &cb_program,
383 .prognumber = cb->cb_prog,
382 .version = nfs_cb_version[1]->number, 384 .version = nfs_cb_version[1]->number,
383 .authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */ 385 .authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */
384 .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET), 386 .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
@@ -396,9 +398,6 @@ static int do_probe_callback(void *data)
396 addr.sin_port = htons(cb->cb_port); 398 addr.sin_port = htons(cb->cb_port);
397 addr.sin_addr.s_addr = htonl(cb->cb_addr); 399 addr.sin_addr.s_addr = htonl(cb->cb_addr);
398 400
399 /* Initialize rpc_stat */
400 memset(args.program->stats, 0, sizeof(struct rpc_stat));
401
402 /* Create RPC client */ 401 /* Create RPC client */
403 client = rpc_create(&args); 402 client = rpc_create(&args);
404 if (IS_ERR(client)) { 403 if (IS_ERR(client)) {
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index e5b51ffafc6c..669461e291ae 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -201,10 +201,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
201 /* Openowner is now set, so sequence id will get bumped. Now we need 201 /* Openowner is now set, so sequence id will get bumped. Now we need
202 * these checks before we do any creates: */ 202 * these checks before we do any creates: */
203 status = nfserr_grace; 203 status = nfserr_grace;
204 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) 204 if (locks_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)
205 goto out; 205 goto out;
206 status = nfserr_no_grace; 206 status = nfserr_no_grace;
207 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) 207 if (!locks_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
208 goto out; 208 goto out;
209 209
210 switch (open->op_claim_type) { 210 switch (open->op_claim_type) {
@@ -575,7 +575,7 @@ nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
575{ 575{
576 __be32 status; 576 __be32 status;
577 577
578 if (nfs4_in_grace()) 578 if (locks_in_grace())
579 return nfserr_grace; 579 return nfserr_grace;
580 status = nfsd_unlink(rqstp, &cstate->current_fh, 0, 580 status = nfsd_unlink(rqstp, &cstate->current_fh, 0,
581 remove->rm_name, remove->rm_namelen); 581 remove->rm_name, remove->rm_namelen);
@@ -596,7 +596,7 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
596 596
597 if (!cstate->save_fh.fh_dentry) 597 if (!cstate->save_fh.fh_dentry)
598 return status; 598 return status;
599 if (nfs4_in_grace() && !(cstate->save_fh.fh_export->ex_flags 599 if (locks_in_grace() && !(cstate->save_fh.fh_export->ex_flags
600 & NFSEXP_NOSUBTREECHECK)) 600 & NFSEXP_NOSUBTREECHECK))
601 return nfserr_grace; 601 return nfserr_grace;
602 status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname, 602 status = nfsd_rename(rqstp, &cstate->save_fh, rename->rn_sname,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1578d7a2667e..0cc7ff5d5ab5 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -61,7 +61,6 @@
61static time_t lease_time = 90; /* default lease time */ 61static time_t lease_time = 90; /* default lease time */
62static time_t user_lease_time = 90; 62static time_t user_lease_time = 90;
63static time_t boot_time; 63static time_t boot_time;
64static int in_grace = 1;
65static u32 current_ownerid = 1; 64static u32 current_ownerid = 1;
66static u32 current_fileid = 1; 65static u32 current_fileid = 1;
67static u32 current_delegid = 1; 66static u32 current_delegid = 1;
@@ -1640,7 +1639,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
1640 case NFS4_OPEN_CLAIM_NULL: 1639 case NFS4_OPEN_CLAIM_NULL:
1641 /* Let's not give out any delegations till everyone's 1640 /* Let's not give out any delegations till everyone's
1642 * had the chance to reclaim theirs.... */ 1641 * had the chance to reclaim theirs.... */
1643 if (nfs4_in_grace()) 1642 if (locks_in_grace())
1644 goto out; 1643 goto out;
1645 if (!atomic_read(&cb->cb_set) || !sop->so_confirmed) 1644 if (!atomic_read(&cb->cb_set) || !sop->so_confirmed)
1646 goto out; 1645 goto out;
@@ -1816,12 +1815,15 @@ out:
1816 return status; 1815 return status;
1817} 1816}
1818 1817
1818struct lock_manager nfsd4_manager = {
1819};
1820
1819static void 1821static void
1820end_grace(void) 1822nfsd4_end_grace(void)
1821{ 1823{
1822 dprintk("NFSD: end of grace period\n"); 1824 dprintk("NFSD: end of grace period\n");
1823 nfsd4_recdir_purge_old(); 1825 nfsd4_recdir_purge_old();
1824 in_grace = 0; 1826 locks_end_grace(&nfsd4_manager);
1825} 1827}
1826 1828
1827static time_t 1829static time_t
@@ -1838,8 +1840,8 @@ nfs4_laundromat(void)
1838 nfs4_lock_state(); 1840 nfs4_lock_state();
1839 1841
1840 dprintk("NFSD: laundromat service - starting\n"); 1842 dprintk("NFSD: laundromat service - starting\n");
1841 if (in_grace) 1843 if (locks_in_grace())
1842 end_grace(); 1844 nfsd4_end_grace();
1843 list_for_each_safe(pos, next, &client_lru) { 1845 list_for_each_safe(pos, next, &client_lru) {
1844 clp = list_entry(pos, struct nfs4_client, cl_lru); 1846 clp = list_entry(pos, struct nfs4_client, cl_lru);
1845 if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { 1847 if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) {
@@ -1974,7 +1976,7 @@ check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags)
1974 return nfserr_bad_stateid; 1976 return nfserr_bad_stateid;
1975 else if (ONE_STATEID(stateid) && (flags & RD_STATE)) 1977 else if (ONE_STATEID(stateid) && (flags & RD_STATE))
1976 return nfs_ok; 1978 return nfs_ok;
1977 else if (nfs4_in_grace()) { 1979 else if (locks_in_grace()) {
1978 /* Answer in remaining cases depends on existance of 1980 /* Answer in remaining cases depends on existance of
1979 * conflicting state; so we must wait out the grace period. */ 1981 * conflicting state; so we must wait out the grace period. */
1980 return nfserr_grace; 1982 return nfserr_grace;
@@ -1993,7 +1995,7 @@ check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags)
1993static inline int 1995static inline int
1994io_during_grace_disallowed(struct inode *inode, int flags) 1996io_during_grace_disallowed(struct inode *inode, int flags)
1995{ 1997{
1996 return nfs4_in_grace() && (flags & (RD_STATE | WR_STATE)) 1998 return locks_in_grace() && (flags & (RD_STATE | WR_STATE))
1997 && mandatory_lock(inode); 1999 && mandatory_lock(inode);
1998} 2000}
1999 2001
@@ -2693,10 +2695,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2693 filp = lock_stp->st_vfs_file; 2695 filp = lock_stp->st_vfs_file;
2694 2696
2695 status = nfserr_grace; 2697 status = nfserr_grace;
2696 if (nfs4_in_grace() && !lock->lk_reclaim) 2698 if (locks_in_grace() && !lock->lk_reclaim)
2697 goto out; 2699 goto out;
2698 status = nfserr_no_grace; 2700 status = nfserr_no_grace;
2699 if (!nfs4_in_grace() && lock->lk_reclaim) 2701 if (!locks_in_grace() && lock->lk_reclaim)
2700 goto out; 2702 goto out;
2701 2703
2702 locks_init_lock(&file_lock); 2704 locks_init_lock(&file_lock);
@@ -2779,7 +2781,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2779 int error; 2781 int error;
2780 __be32 status; 2782 __be32 status;
2781 2783
2782 if (nfs4_in_grace()) 2784 if (locks_in_grace())
2783 return nfserr_grace; 2785 return nfserr_grace;
2784 2786
2785 if (check_lock_length(lockt->lt_offset, lockt->lt_length)) 2787 if (check_lock_length(lockt->lt_offset, lockt->lt_length))
@@ -3192,9 +3194,9 @@ __nfs4_state_start(void)
3192 unsigned long grace_time; 3194 unsigned long grace_time;
3193 3195
3194 boot_time = get_seconds(); 3196 boot_time = get_seconds();
3195 grace_time = get_nfs_grace_period(); 3197 grace_time = get_nfs4_grace_period();
3196 lease_time = user_lease_time; 3198 lease_time = user_lease_time;
3197 in_grace = 1; 3199 locks_start_grace(&nfsd4_manager);
3198 printk(KERN_INFO "NFSD: starting %ld-second grace period\n", 3200 printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
3199 grace_time/HZ); 3201 grace_time/HZ);
3200 laundry_wq = create_singlethread_workqueue("nfsd4"); 3202 laundry_wq = create_singlethread_workqueue("nfsd4");
@@ -3213,12 +3215,6 @@ nfs4_state_start(void)
3213 return; 3215 return;
3214} 3216}
3215 3217
3216int
3217nfs4_in_grace(void)
3218{
3219 return in_grace;
3220}
3221
3222time_t 3218time_t
3223nfs4_lease_time(void) 3219nfs4_lease_time(void)
3224{ 3220{
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 14ba4d9b2859..afcdf4b76843 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -413,6 +413,18 @@ out_nfserr:
413} 413}
414 414
415static __be32 415static __be32
416nfsd4_decode_stateid(struct nfsd4_compoundargs *argp, stateid_t *sid)
417{
418 DECODE_HEAD;
419
420 READ_BUF(sizeof(stateid_t));
421 READ32(sid->si_generation);
422 COPYMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
423
424 DECODE_TAIL;
425}
426
427static __be32
416nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) 428nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access)
417{ 429{
418 DECODE_HEAD; 430 DECODE_HEAD;
@@ -429,10 +441,9 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
429 DECODE_HEAD; 441 DECODE_HEAD;
430 442
431 close->cl_stateowner = NULL; 443 close->cl_stateowner = NULL;
432 READ_BUF(4 + sizeof(stateid_t)); 444 READ_BUF(4);
433 READ32(close->cl_seqid); 445 READ32(close->cl_seqid);
434 READ32(close->cl_stateid.si_generation); 446 return nfsd4_decode_stateid(argp, &close->cl_stateid);
435 COPYMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
436 447
437 DECODE_TAIL; 448 DECODE_TAIL;
438} 449}
@@ -493,13 +504,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
493static inline __be32 504static inline __be32
494nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) 505nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
495{ 506{
496 DECODE_HEAD; 507 return nfsd4_decode_stateid(argp, &dr->dr_stateid);
497
498 READ_BUF(sizeof(stateid_t));
499 READ32(dr->dr_stateid.si_generation);
500 COPYMEM(&dr->dr_stateid.si_opaque, sizeof(stateid_opaque_t));
501
502 DECODE_TAIL;
503} 508}
504 509
505static inline __be32 510static inline __be32
@@ -542,20 +547,22 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
542 READ32(lock->lk_is_new); 547 READ32(lock->lk_is_new);
543 548
544 if (lock->lk_is_new) { 549 if (lock->lk_is_new) {
545 READ_BUF(36); 550 READ_BUF(4);
546 READ32(lock->lk_new_open_seqid); 551 READ32(lock->lk_new_open_seqid);
547 READ32(lock->lk_new_open_stateid.si_generation); 552 status = nfsd4_decode_stateid(argp, &lock->lk_new_open_stateid);
548 553 if (status)
549 COPYMEM(&lock->lk_new_open_stateid.si_opaque, sizeof(stateid_opaque_t)); 554 return status;
555 READ_BUF(8 + sizeof(clientid_t));
550 READ32(lock->lk_new_lock_seqid); 556 READ32(lock->lk_new_lock_seqid);
551 COPYMEM(&lock->lk_new_clientid, sizeof(clientid_t)); 557 COPYMEM(&lock->lk_new_clientid, sizeof(clientid_t));
552 READ32(lock->lk_new_owner.len); 558 READ32(lock->lk_new_owner.len);
553 READ_BUF(lock->lk_new_owner.len); 559 READ_BUF(lock->lk_new_owner.len);
554 READMEM(lock->lk_new_owner.data, lock->lk_new_owner.len); 560 READMEM(lock->lk_new_owner.data, lock->lk_new_owner.len);
555 } else { 561 } else {
556 READ_BUF(20); 562 status = nfsd4_decode_stateid(argp, &lock->lk_old_lock_stateid);
557 READ32(lock->lk_old_lock_stateid.si_generation); 563 if (status)
558 COPYMEM(&lock->lk_old_lock_stateid.si_opaque, sizeof(stateid_opaque_t)); 564 return status;
565 READ_BUF(4);
559 READ32(lock->lk_old_lock_seqid); 566 READ32(lock->lk_old_lock_seqid);
560 } 567 }
561 568
@@ -587,13 +594,15 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
587 DECODE_HEAD; 594 DECODE_HEAD;
588 595
589 locku->lu_stateowner = NULL; 596 locku->lu_stateowner = NULL;
590 READ_BUF(24 + sizeof(stateid_t)); 597 READ_BUF(8);
591 READ32(locku->lu_type); 598 READ32(locku->lu_type);
592 if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT)) 599 if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT))
593 goto xdr_error; 600 goto xdr_error;
594 READ32(locku->lu_seqid); 601 READ32(locku->lu_seqid);
595 READ32(locku->lu_stateid.si_generation); 602 status = nfsd4_decode_stateid(argp, &locku->lu_stateid);
596 COPYMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t)); 603 if (status)
604 return status;
605 READ_BUF(16);
597 READ64(locku->lu_offset); 606 READ64(locku->lu_offset);
598 READ64(locku->lu_length); 607 READ64(locku->lu_length);
599 608
@@ -678,8 +687,10 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
678 READ32(open->op_delegate_type); 687 READ32(open->op_delegate_type);
679 break; 688 break;
680 case NFS4_OPEN_CLAIM_DELEGATE_CUR: 689 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
681 READ_BUF(sizeof(stateid_t) + 4); 690 status = nfsd4_decode_stateid(argp, &open->op_delegate_stateid);
682 COPYMEM(&open->op_delegate_stateid, sizeof(stateid_t)); 691 if (status)
692 return status;
693 READ_BUF(4);
683 READ32(open->op_fname.len); 694 READ32(open->op_fname.len);
684 READ_BUF(open->op_fname.len); 695 READ_BUF(open->op_fname.len);
685 SAVEMEM(open->op_fname.data, open->op_fname.len); 696 SAVEMEM(open->op_fname.data, open->op_fname.len);
@@ -699,9 +710,10 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
699 DECODE_HEAD; 710 DECODE_HEAD;
700 711
701 open_conf->oc_stateowner = NULL; 712 open_conf->oc_stateowner = NULL;
702 READ_BUF(4 + sizeof(stateid_t)); 713 status = nfsd4_decode_stateid(argp, &open_conf->oc_req_stateid);
703 READ32(open_conf->oc_req_stateid.si_generation); 714 if (status)
704 COPYMEM(&open_conf->oc_req_stateid.si_opaque, sizeof(stateid_opaque_t)); 715 return status;
716 READ_BUF(4);
705 READ32(open_conf->oc_seqid); 717 READ32(open_conf->oc_seqid);
706 718
707 DECODE_TAIL; 719 DECODE_TAIL;
@@ -713,9 +725,10 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
713 DECODE_HEAD; 725 DECODE_HEAD;
714 726
715 open_down->od_stateowner = NULL; 727 open_down->od_stateowner = NULL;
716 READ_BUF(12 + sizeof(stateid_t)); 728 status = nfsd4_decode_stateid(argp, &open_down->od_stateid);
717 READ32(open_down->od_stateid.si_generation); 729 if (status)
718 COPYMEM(&open_down->od_stateid.si_opaque, sizeof(stateid_opaque_t)); 730 return status;
731 READ_BUF(12);
719 READ32(open_down->od_seqid); 732 READ32(open_down->od_seqid);
720 READ32(open_down->od_share_access); 733 READ32(open_down->od_share_access);
721 READ32(open_down->od_share_deny); 734 READ32(open_down->od_share_deny);
@@ -743,9 +756,10 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
743{ 756{
744 DECODE_HEAD; 757 DECODE_HEAD;
745 758
746 READ_BUF(sizeof(stateid_t) + 12); 759 status = nfsd4_decode_stateid(argp, &read->rd_stateid);
747 READ32(read->rd_stateid.si_generation); 760 if (status)
748 COPYMEM(&read->rd_stateid.si_opaque, sizeof(stateid_opaque_t)); 761 return status;
762 READ_BUF(12);
749 READ64(read->rd_offset); 763 READ64(read->rd_offset);
750 READ32(read->rd_length); 764 READ32(read->rd_length);
751 765
@@ -834,15 +848,13 @@ nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
834static __be32 848static __be32
835nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) 849nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
836{ 850{
837 DECODE_HEAD; 851 __be32 status;
838
839 READ_BUF(sizeof(stateid_t));
840 READ32(setattr->sa_stateid.si_generation);
841 COPYMEM(&setattr->sa_stateid.si_opaque, sizeof(stateid_opaque_t));
842 if ((status = nfsd4_decode_fattr(argp, setattr->sa_bmval, &setattr->sa_iattr, &setattr->sa_acl)))
843 goto out;
844 852
845 DECODE_TAIL; 853 status = nfsd4_decode_stateid(argp, &setattr->sa_stateid);
854 if (status)
855 return status;
856 return nfsd4_decode_fattr(argp, setattr->sa_bmval,
857 &setattr->sa_iattr, &setattr->sa_acl);
846} 858}
847 859
848static __be32 860static __be32
@@ -927,9 +939,10 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
927 int len; 939 int len;
928 DECODE_HEAD; 940 DECODE_HEAD;
929 941
930 READ_BUF(sizeof(stateid_opaque_t) + 20); 942 status = nfsd4_decode_stateid(argp, &write->wr_stateid);
931 READ32(write->wr_stateid.si_generation); 943 if (status)
932 COPYMEM(&write->wr_stateid.si_opaque, sizeof(stateid_opaque_t)); 944 return status;
945 READ_BUF(16);
933 READ64(write->wr_offset); 946 READ64(write->wr_offset);
934 READ32(write->wr_stable_how); 947 READ32(write->wr_stable_how);
935 if (write->wr_stable_how > 2) 948 if (write->wr_stable_how > 2)
@@ -1183,7 +1196,6 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1183 * Header routine to setup seqid operation replay cache 1196 * Header routine to setup seqid operation replay cache
1184 */ 1197 */
1185#define ENCODE_SEQID_OP_HEAD \ 1198#define ENCODE_SEQID_OP_HEAD \
1186 __be32 *p; \
1187 __be32 *save; \ 1199 __be32 *save; \
1188 \ 1200 \
1189 save = resp->p; 1201 save = resp->p;
@@ -1950,6 +1962,17 @@ fail:
1950 return -EINVAL; 1962 return -EINVAL;
1951} 1963}
1952 1964
1965static void
1966nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid)
1967{
1968 ENCODE_HEAD;
1969
1970 RESERVE_SPACE(sizeof(stateid_t));
1971 WRITE32(sid->si_generation);
1972 WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
1973 ADJUST_ARGS();
1974}
1975
1953static __be32 1976static __be32
1954nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access) 1977nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
1955{ 1978{
@@ -1969,12 +1992,9 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_c
1969{ 1992{
1970 ENCODE_SEQID_OP_HEAD; 1993 ENCODE_SEQID_OP_HEAD;
1971 1994
1972 if (!nfserr) { 1995 if (!nfserr)
1973 RESERVE_SPACE(sizeof(stateid_t)); 1996 nfsd4_encode_stateid(resp, &close->cl_stateid);
1974 WRITE32(close->cl_stateid.si_generation); 1997
1975 WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
1976 ADJUST_ARGS();
1977 }
1978 ENCODE_SEQID_OP_TAIL(close->cl_stateowner); 1998 ENCODE_SEQID_OP_TAIL(close->cl_stateowner);
1979 return nfserr; 1999 return nfserr;
1980} 2000}
@@ -2074,12 +2094,9 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lo
2074{ 2094{
2075 ENCODE_SEQID_OP_HEAD; 2095 ENCODE_SEQID_OP_HEAD;
2076 2096
2077 if (!nfserr) { 2097 if (!nfserr)
2078 RESERVE_SPACE(4 + sizeof(stateid_t)); 2098 nfsd4_encode_stateid(resp, &lock->lk_resp_stateid);
2079 WRITE32(lock->lk_resp_stateid.si_generation); 2099 else if (nfserr == nfserr_denied)
2080 WRITEMEM(&lock->lk_resp_stateid.si_opaque, sizeof(stateid_opaque_t));
2081 ADJUST_ARGS();
2082 } else if (nfserr == nfserr_denied)
2083 nfsd4_encode_lock_denied(resp, &lock->lk_denied); 2100 nfsd4_encode_lock_denied(resp, &lock->lk_denied);
2084 2101
2085 ENCODE_SEQID_OP_TAIL(lock->lk_replay_owner); 2102 ENCODE_SEQID_OP_TAIL(lock->lk_replay_owner);
@@ -2099,13 +2116,9 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_l
2099{ 2116{
2100 ENCODE_SEQID_OP_HEAD; 2117 ENCODE_SEQID_OP_HEAD;
2101 2118
2102 if (!nfserr) { 2119 if (!nfserr)
2103 RESERVE_SPACE(sizeof(stateid_t)); 2120 nfsd4_encode_stateid(resp, &locku->lu_stateid);
2104 WRITE32(locku->lu_stateid.si_generation); 2121
2105 WRITEMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t));
2106 ADJUST_ARGS();
2107 }
2108
2109 ENCODE_SEQID_OP_TAIL(locku->lu_stateowner); 2122 ENCODE_SEQID_OP_TAIL(locku->lu_stateowner);
2110 return nfserr; 2123 return nfserr;
2111} 2124}
@@ -2128,14 +2141,14 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li
2128static __be32 2141static __be32
2129nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open) 2142nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
2130{ 2143{
2144 ENCODE_HEAD;
2131 ENCODE_SEQID_OP_HEAD; 2145 ENCODE_SEQID_OP_HEAD;
2132 2146
2133 if (nfserr) 2147 if (nfserr)
2134 goto out; 2148 goto out;
2135 2149
2136 RESERVE_SPACE(36 + sizeof(stateid_t)); 2150 nfsd4_encode_stateid(resp, &open->op_stateid);
2137 WRITE32(open->op_stateid.si_generation); 2151 RESERVE_SPACE(40);
2138 WRITEMEM(&open->op_stateid.si_opaque, sizeof(stateid_opaque_t));
2139 WRITECINFO(open->op_cinfo); 2152 WRITECINFO(open->op_cinfo);
2140 WRITE32(open->op_rflags); 2153 WRITE32(open->op_rflags);
2141 WRITE32(2); 2154 WRITE32(2);
@@ -2148,8 +2161,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2148 case NFS4_OPEN_DELEGATE_NONE: 2161 case NFS4_OPEN_DELEGATE_NONE:
2149 break; 2162 break;
2150 case NFS4_OPEN_DELEGATE_READ: 2163 case NFS4_OPEN_DELEGATE_READ:
2151 RESERVE_SPACE(20 + sizeof(stateid_t)); 2164 nfsd4_encode_stateid(resp, &open->op_delegate_stateid);
2152 WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t)); 2165 RESERVE_SPACE(20);
2153 WRITE32(open->op_recall); 2166 WRITE32(open->op_recall);
2154 2167
2155 /* 2168 /*
@@ -2162,8 +2175,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2162 ADJUST_ARGS(); 2175 ADJUST_ARGS();
2163 break; 2176 break;
2164 case NFS4_OPEN_DELEGATE_WRITE: 2177 case NFS4_OPEN_DELEGATE_WRITE:
2165 RESERVE_SPACE(32 + sizeof(stateid_t)); 2178 nfsd4_encode_stateid(resp, &open->op_delegate_stateid);
2166 WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t)); 2179 RESERVE_SPACE(32);
2167 WRITE32(0); 2180 WRITE32(0);
2168 2181
2169 /* 2182 /*
@@ -2195,13 +2208,9 @@ static __be32
2195nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc) 2208nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc)
2196{ 2209{
2197 ENCODE_SEQID_OP_HEAD; 2210 ENCODE_SEQID_OP_HEAD;
2198 2211
2199 if (!nfserr) { 2212 if (!nfserr)
2200 RESERVE_SPACE(sizeof(stateid_t)); 2213 nfsd4_encode_stateid(resp, &oc->oc_resp_stateid);
2201 WRITE32(oc->oc_resp_stateid.si_generation);
2202 WRITEMEM(&oc->oc_resp_stateid.si_opaque, sizeof(stateid_opaque_t));
2203 ADJUST_ARGS();
2204 }
2205 2214
2206 ENCODE_SEQID_OP_TAIL(oc->oc_stateowner); 2215 ENCODE_SEQID_OP_TAIL(oc->oc_stateowner);
2207 return nfserr; 2216 return nfserr;
@@ -2211,13 +2220,9 @@ static __be32
2211nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od) 2220nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
2212{ 2221{
2213 ENCODE_SEQID_OP_HEAD; 2222 ENCODE_SEQID_OP_HEAD;
2214 2223
2215 if (!nfserr) { 2224 if (!nfserr)
2216 RESERVE_SPACE(sizeof(stateid_t)); 2225 nfsd4_encode_stateid(resp, &od->od_stateid);
2217 WRITE32(od->od_stateid.si_generation);
2218 WRITEMEM(&od->od_stateid.si_opaque, sizeof(stateid_opaque_t));
2219 ADJUST_ARGS();
2220 }
2221 2226
2222 ENCODE_SEQID_OP_TAIL(od->od_stateowner); 2227 ENCODE_SEQID_OP_TAIL(od->od_stateowner);
2223 return nfserr; 2228 return nfserr;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index c53e65f8f3a2..97543df58242 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -614,10 +614,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
614 return -EINVAL; 614 return -EINVAL;
615 err = nfsd_create_serv(); 615 err = nfsd_create_serv();
616 if (!err) { 616 if (!err) {
617 int proto = 0; 617 err = svc_addsock(nfsd_serv, fd, buf);
618 err = svc_addsock(nfsd_serv, fd, buf, &proto);
619 if (err >= 0) { 618 if (err >= 0) {
620 err = lockd_up(proto); 619 err = lockd_up();
621 if (err < 0) 620 if (err < 0)
622 svc_sock_names(buf+strlen(buf)+1, nfsd_serv, buf); 621 svc_sock_names(buf+strlen(buf)+1, nfsd_serv, buf);
623 } 622 }
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index ea37c96f0445..cd25d91895a1 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -302,17 +302,27 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
302 if (error) 302 if (error)
303 goto out; 303 goto out;
304 304
305 if (!(access & NFSD_MAY_LOCK)) { 305 /*
306 /* 306 * pseudoflavor restrictions are not enforced on NLM,
307 * pseudoflavor restrictions are not enforced on NLM, 307 * which clients virtually always use auth_sys for,
308 * which clients virtually always use auth_sys for, 308 * even while using RPCSEC_GSS for NFS.
309 * even while using RPCSEC_GSS for NFS. 309 */
310 */ 310 if (access & NFSD_MAY_LOCK)
311 error = check_nfsd_access(exp, rqstp); 311 goto skip_pseudoflavor_check;
312 if (error) 312 /*
313 goto out; 313 * Clients may expect to be able to use auth_sys during mount,
314 } 314 * even if they use gss for everything else; see section 2.3.2
315 * of rfc 2623.
316 */
317 if (access & NFSD_MAY_BYPASS_GSS_ON_ROOT
318 && exp->ex_path.dentry == dentry)
319 goto skip_pseudoflavor_check;
320
321 error = check_nfsd_access(exp, rqstp);
322 if (error)
323 goto out;
315 324
325skip_pseudoflavor_check:
316 /* Finally, check access permissions. */ 326 /* Finally, check access permissions. */
317 error = nfsd_permission(rqstp, exp, dentry, access); 327 error = nfsd_permission(rqstp, exp, dentry, access);
318 328
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 0766f95d236a..5cffeca7acef 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -65,7 +65,8 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
65 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 65 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
66 66
67 fh_copy(&resp->fh, &argp->fh); 67 fh_copy(&resp->fh, &argp->fh);
68 nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); 68 nfserr = fh_verify(rqstp, &resp->fh, 0,
69 NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
69 return nfsd_return_attrs(nfserr, resp); 70 return nfsd_return_attrs(nfserr, resp);
70} 71}
71 72
@@ -521,7 +522,8 @@ nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
521 522
522 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); 523 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
523 524
524 nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats); 525 nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats,
526 NFSD_MAY_BYPASS_GSS_ON_ROOT);
525 fh_put(&argp->fh); 527 fh_put(&argp->fh);
526 return nfserr; 528 return nfserr;
527} 529}
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 80292ff5e924..59eeb46f82c5 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -229,6 +229,7 @@ int nfsd_create_serv(void)
229 229
230 atomic_set(&nfsd_busy, 0); 230 atomic_set(&nfsd_busy, 0);
231 nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, 231 nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
232 AF_INET,
232 nfsd_last_thread, nfsd, THIS_MODULE); 233 nfsd_last_thread, nfsd, THIS_MODULE);
233 if (nfsd_serv == NULL) 234 if (nfsd_serv == NULL)
234 err = -ENOMEM; 235 err = -ENOMEM;
@@ -243,25 +244,20 @@ static int nfsd_init_socks(int port)
243 if (!list_empty(&nfsd_serv->sv_permsocks)) 244 if (!list_empty(&nfsd_serv->sv_permsocks))
244 return 0; 245 return 0;
245 246
246 error = lockd_up(IPPROTO_UDP); 247 error = svc_create_xprt(nfsd_serv, "udp", port,
247 if (error >= 0) {
248 error = svc_create_xprt(nfsd_serv, "udp", port,
249 SVC_SOCK_DEFAULTS); 248 SVC_SOCK_DEFAULTS);
250 if (error < 0)
251 lockd_down();
252 }
253 if (error < 0) 249 if (error < 0)
254 return error; 250 return error;
255 251
256 error = lockd_up(IPPROTO_TCP); 252 error = svc_create_xprt(nfsd_serv, "tcp", port,
257 if (error >= 0) {
258 error = svc_create_xprt(nfsd_serv, "tcp", port,
259 SVC_SOCK_DEFAULTS); 253 SVC_SOCK_DEFAULTS);
260 if (error < 0)
261 lockd_down();
262 }
263 if (error < 0) 254 if (error < 0)
264 return error; 255 return error;
256
257 error = lockd_up();
258 if (error < 0)
259 return error;
260
265 return 0; 261 return 0;
266} 262}
267 263
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 18060bed5267..aa1d0d6489a1 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -83,7 +83,6 @@ struct raparm_hbucket {
83 spinlock_t pb_lock; 83 spinlock_t pb_lock;
84} ____cacheline_aligned_in_smp; 84} ____cacheline_aligned_in_smp;
85 85
86static struct raparms * raparml;
87#define RAPARM_HASH_BITS 4 86#define RAPARM_HASH_BITS 4
88#define RAPARM_HASH_SIZE (1<<RAPARM_HASH_BITS) 87#define RAPARM_HASH_SIZE (1<<RAPARM_HASH_BITS)
89#define RAPARM_HASH_MASK (RAPARM_HASH_SIZE-1) 88#define RAPARM_HASH_MASK (RAPARM_HASH_SIZE-1)
@@ -1866,9 +1865,9 @@ out:
1866 * N.B. After this call fhp needs an fh_put 1865 * N.B. After this call fhp needs an fh_put
1867 */ 1866 */
1868__be32 1867__be32
1869nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) 1868nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, int access)
1870{ 1869{
1871 __be32 err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); 1870 __be32 err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access);
1872 if (!err && vfs_statfs(fhp->fh_dentry,stat)) 1871 if (!err && vfs_statfs(fhp->fh_dentry,stat))
1873 err = nfserr_io; 1872 err = nfserr_io;
1874 return err; 1873 return err;
@@ -1966,11 +1965,20 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
1966void 1965void
1967nfsd_racache_shutdown(void) 1966nfsd_racache_shutdown(void)
1968{ 1967{
1969 if (!raparml) 1968 struct raparms *raparm, *last_raparm;
1970 return; 1969 unsigned int i;
1970
1971 dprintk("nfsd: freeing readahead buffers.\n"); 1971 dprintk("nfsd: freeing readahead buffers.\n");
1972 kfree(raparml); 1972
1973 raparml = NULL; 1973 for (i = 0; i < RAPARM_HASH_SIZE; i++) {
1974 raparm = raparm_hash[i].pb_head;
1975 while(raparm) {
1976 last_raparm = raparm;
1977 raparm = raparm->p_next;
1978 kfree(last_raparm);
1979 }
1980 raparm_hash[i].pb_head = NULL;
1981 }
1974} 1982}
1975/* 1983/*
1976 * Initialize readahead param cache 1984 * Initialize readahead param cache
@@ -1981,35 +1989,38 @@ nfsd_racache_init(int cache_size)
1981 int i; 1989 int i;
1982 int j = 0; 1990 int j = 0;
1983 int nperbucket; 1991 int nperbucket;
1992 struct raparms **raparm = NULL;
1984 1993
1985 1994
1986 if (raparml) 1995 if (raparm_hash[0].pb_head)
1987 return 0; 1996 return 0;
1988 if (cache_size < 2*RAPARM_HASH_SIZE) 1997 nperbucket = DIV_ROUND_UP(cache_size, RAPARM_HASH_SIZE);
1989 cache_size = 2*RAPARM_HASH_SIZE; 1998 if (nperbucket < 2)
1990 raparml = kcalloc(cache_size, sizeof(struct raparms), GFP_KERNEL); 1999 nperbucket = 2;
1991 2000 cache_size = nperbucket * RAPARM_HASH_SIZE;
1992 if (!raparml) {
1993 printk(KERN_WARNING
1994 "nfsd: Could not allocate memory read-ahead cache.\n");
1995 return -ENOMEM;
1996 }
1997 2001
1998 dprintk("nfsd: allocating %d readahead buffers.\n", cache_size); 2002 dprintk("nfsd: allocating %d readahead buffers.\n", cache_size);
1999 for (i = 0 ; i < RAPARM_HASH_SIZE ; i++) { 2003
2000 raparm_hash[i].pb_head = NULL; 2004 for (i = 0; i < RAPARM_HASH_SIZE; i++) {
2001 spin_lock_init(&raparm_hash[i].pb_lock); 2005 spin_lock_init(&raparm_hash[i].pb_lock);
2002 } 2006
2003 nperbucket = DIV_ROUND_UP(cache_size, RAPARM_HASH_SIZE); 2007 raparm = &raparm_hash[i].pb_head;
2004 for (i = 0; i < cache_size - 1; i++) { 2008 for (j = 0; j < nperbucket; j++) {
2005 if (i % nperbucket == 0) 2009 *raparm = kzalloc(sizeof(struct raparms), GFP_KERNEL);
2006 raparm_hash[j++].pb_head = raparml + i; 2010 if (!*raparm)
2007 if (i % nperbucket < nperbucket-1) 2011 goto out_nomem;
2008 raparml[i].p_next = raparml + i + 1; 2012 raparm = &(*raparm)->p_next;
2013 }
2014 *raparm = NULL;
2009 } 2015 }
2010 2016
2011 nfsdstats.ra_size = cache_size; 2017 nfsdstats.ra_size = cache_size;
2012 return 0; 2018 return 0;
2019
2020out_nomem:
2021 dprintk("nfsd: kmalloc failed, freeing readahead buffers\n");
2022 nfsd_racache_shutdown();
2023 return -ENOMEM;
2013} 2024}
2014 2025
2015#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 2026#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 29e20c6b1f7f..1aabbe2592e1 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -684,6 +684,7 @@ static int cmdline_read_proc(char *page, char **start, off_t off,
684 return proc_calc_metrics(page, start, off, count, eof, len); 684 return proc_calc_metrics(page, start, off, count, eof, len);
685} 685}
686 686
687#ifdef CONFIG_FILE_LOCKING
687static int locks_open(struct inode *inode, struct file *filp) 688static int locks_open(struct inode *inode, struct file *filp)
688{ 689{
689 return seq_open(filp, &locks_seq_operations); 690 return seq_open(filp, &locks_seq_operations);
@@ -695,6 +696,7 @@ static const struct file_operations proc_locks_operations = {
695 .llseek = seq_lseek, 696 .llseek = seq_lseek,
696 .release = seq_release, 697 .release = seq_release,
697}; 698};
699#endif /* CONFIG_FILE_LOCKING */
698 700
699static int execdomains_read_proc(char *page, char **start, off_t off, 701static int execdomains_read_proc(char *page, char **start, off_t off,
700 int count, int *eof, void *data) 702 int count, int *eof, void *data)
@@ -888,7 +890,9 @@ void __init proc_misc_init(void)
888#ifdef CONFIG_PRINTK 890#ifdef CONFIG_PRINTK
889 proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations); 891 proc_create("kmsg", S_IRUSR, NULL, &proc_kmsg_operations);
890#endif 892#endif
893#ifdef CONFIG_FILE_LOCKING
891 proc_create("locks", 0, NULL, &proc_locks_operations); 894 proc_create("locks", 0, NULL, &proc_locks_operations);
895#endif
892 proc_create("devices", 0, NULL, &proc_devinfo_operations); 896 proc_create("devices", 0, NULL, &proc_devinfo_operations);
893 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); 897 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations);
894#ifdef CONFIG_BLOCK 898#ifdef CONFIG_BLOCK
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index f42f80a3b1fa..a44d68eb50b5 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1338,6 +1338,10 @@ __xfs_get_blocks(
1338 offset = (xfs_off_t)iblock << inode->i_blkbits; 1338 offset = (xfs_off_t)iblock << inode->i_blkbits;
1339 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); 1339 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
1340 size = bh_result->b_size; 1340 size = bh_result->b_size;
1341
1342 if (!create && direct && offset >= i_size_read(inode))
1343 return 0;
1344
1341 error = xfs_iomap(XFS_I(inode), offset, size, 1345 error = xfs_iomap(XFS_I(inode), offset, size,
1342 create ? flags : BMAPI_READ, &iomap, &niomap); 1346 create ? flags : BMAPI_READ, &iomap, &niomap);
1343 if (error) 1347 if (error)
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 73c65f19e549..18d3c8487835 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1302,9 +1302,29 @@ xfs_fs_remount(
1302 mp->m_flags &= ~XFS_MOUNT_BARRIER; 1302 mp->m_flags &= ~XFS_MOUNT_BARRIER;
1303 break; 1303 break;
1304 default: 1304 default:
1305 /*
1306 * Logically we would return an error here to prevent
1307 * users from believing they might have changed
1308 * mount options using remount which can't be changed.
1309 *
1310 * But unfortunately mount(8) adds all options from
1311 * mtab and fstab to the mount arguments in some cases
1312 * so we can't blindly reject options, but have to
1313 * check for each specified option if it actually
1314 * differs from the currently set option and only
1315 * reject it if that's the case.
1316 *
1317 * Until that is implemented we return success for
1318 * every remount request, and silently ignore all
1319 * options that we can't actually change.
1320 */
1321#if 0
1305 printk(KERN_INFO 1322 printk(KERN_INFO
1306 "XFS: mount option \"%s\" not supported for remount\n", p); 1323 "XFS: mount option \"%s\" not supported for remount\n", p);
1307 return -EINVAL; 1324 return -EINVAL;
1325#else
1326 return 0;
1327#endif
1308 } 1328 }
1309 } 1329 }
1310 1330
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 608c30c3f76b..002fc2617c8e 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -732,6 +732,7 @@ xfs_buf_item_init(
732 bip->bli_item.li_ops = &xfs_buf_item_ops; 732 bip->bli_item.li_ops = &xfs_buf_item_ops;
733 bip->bli_item.li_mountp = mp; 733 bip->bli_item.li_mountp = mp;
734 bip->bli_buf = bp; 734 bip->bli_buf = bp;
735 xfs_buf_hold(bp);
735 bip->bli_format.blf_type = XFS_LI_BUF; 736 bip->bli_format.blf_type = XFS_LI_BUF;
736 bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp); 737 bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp);
737 bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp)); 738 bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp));
@@ -867,6 +868,21 @@ xfs_buf_item_dirty(
867 return (bip->bli_flags & XFS_BLI_DIRTY); 868 return (bip->bli_flags & XFS_BLI_DIRTY);
868} 869}
869 870
871STATIC void
872xfs_buf_item_free(
873 xfs_buf_log_item_t *bip)
874{
875#ifdef XFS_TRANS_DEBUG
876 kmem_free(bip->bli_orig);
877 kmem_free(bip->bli_logged);
878#endif /* XFS_TRANS_DEBUG */
879
880#ifdef XFS_BLI_TRACE
881 ktrace_free(bip->bli_trace);
882#endif
883 kmem_zone_free(xfs_buf_item_zone, bip);
884}
885
870/* 886/*
871 * This is called when the buf log item is no longer needed. It should 887 * This is called when the buf log item is no longer needed. It should
872 * free the buf log item associated with the given buffer and clear 888 * free the buf log item associated with the given buffer and clear
@@ -887,18 +903,8 @@ xfs_buf_item_relse(
887 (XFS_BUF_IODONE_FUNC(bp) != NULL)) { 903 (XFS_BUF_IODONE_FUNC(bp) != NULL)) {
888 XFS_BUF_CLR_IODONE_FUNC(bp); 904 XFS_BUF_CLR_IODONE_FUNC(bp);
889 } 905 }
890 906 xfs_buf_rele(bp);
891#ifdef XFS_TRANS_DEBUG 907 xfs_buf_item_free(bip);
892 kmem_free(bip->bli_orig);
893 bip->bli_orig = NULL;
894 kmem_free(bip->bli_logged);
895 bip->bli_logged = NULL;
896#endif /* XFS_TRANS_DEBUG */
897
898#ifdef XFS_BLI_TRACE
899 ktrace_free(bip->bli_trace);
900#endif
901 kmem_zone_free(xfs_buf_item_zone, bip);
902} 908}
903 909
904 910
@@ -1120,6 +1126,7 @@ xfs_buf_iodone(
1120 1126
1121 ASSERT(bip->bli_buf == bp); 1127 ASSERT(bip->bli_buf == bp);
1122 1128
1129 xfs_buf_rele(bp);
1123 mp = bip->bli_item.li_mountp; 1130 mp = bip->bli_item.li_mountp;
1124 1131
1125 /* 1132 /*
@@ -1136,18 +1143,7 @@ xfs_buf_iodone(
1136 * xfs_trans_delete_ail() drops the AIL lock. 1143 * xfs_trans_delete_ail() drops the AIL lock.
1137 */ 1144 */
1138 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip); 1145 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
1139 1146 xfs_buf_item_free(bip);
1140#ifdef XFS_TRANS_DEBUG
1141 kmem_free(bip->bli_orig);
1142 bip->bli_orig = NULL;
1143 kmem_free(bip->bli_logged);
1144 bip->bli_logged = NULL;
1145#endif /* XFS_TRANS_DEBUG */
1146
1147#ifdef XFS_BLI_TRACE
1148 ktrace_free(bip->bli_trace);
1149#endif
1150 kmem_zone_free(xfs_buf_item_zone, bip);
1151} 1147}
1152 1148
1153#if defined(XFS_BLI_TRACE) 1149#if defined(XFS_BLI_TRACE)
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 760f4c5b5160..75b0cd4da0ea 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -149,7 +149,14 @@ xfs_swap_extents(
149 149
150 sbp = &sxp->sx_stat; 150 sbp = &sxp->sx_stat;
151 151
152 xfs_lock_two_inodes(ip, tip, lock_flags); 152 /*
153 * we have to do two separate lock calls here to keep lockdep
154 * happy. If we try to get all the locks in one call, lock will
155 * report false positives when we drop the ILOCK and regain them
156 * below.
157 */
158 xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
159 xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
153 locked = 1; 160 locked = 1;
154 161
155 /* Verify that both files have the same format */ 162 /* Verify that both files have the same format */
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index ccba14eb9dbe..503ea89e8b9a 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -124,16 +124,27 @@ STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
124STATIC int xlog_iclogs_empty(xlog_t *log); 124STATIC int xlog_iclogs_empty(xlog_t *log);
125 125
126#if defined(XFS_LOG_TRACE) 126#if defined(XFS_LOG_TRACE)
127
128#define XLOG_TRACE_LOGGRANT_SIZE 2048
129#define XLOG_TRACE_ICLOG_SIZE 256
130
131void
132xlog_trace_loggrant_alloc(xlog_t *log)
133{
134 log->l_grant_trace = ktrace_alloc(XLOG_TRACE_LOGGRANT_SIZE, KM_NOFS);
135}
136
137void
138xlog_trace_loggrant_dealloc(xlog_t *log)
139{
140 ktrace_free(log->l_grant_trace);
141}
142
127void 143void
128xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string) 144xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
129{ 145{
130 unsigned long cnts; 146 unsigned long cnts;
131 147
132 if (!log->l_grant_trace) {
133 log->l_grant_trace = ktrace_alloc(2048, KM_NOSLEEP);
134 if (!log->l_grant_trace)
135 return;
136 }
137 /* ticket counts are 1 byte each */ 148 /* ticket counts are 1 byte each */
138 cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8; 149 cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8;
139 150
@@ -157,10 +168,20 @@ xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
157} 168}
158 169
159void 170void
171xlog_trace_iclog_alloc(xlog_in_core_t *iclog)
172{
173 iclog->ic_trace = ktrace_alloc(XLOG_TRACE_ICLOG_SIZE, KM_NOFS);
174}
175
176void
177xlog_trace_iclog_dealloc(xlog_in_core_t *iclog)
178{
179 ktrace_free(iclog->ic_trace);
180}
181
182void
160xlog_trace_iclog(xlog_in_core_t *iclog, uint state) 183xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
161{ 184{
162 if (!iclog->ic_trace)
163 iclog->ic_trace = ktrace_alloc(256, KM_NOFS);
164 ktrace_enter(iclog->ic_trace, 185 ktrace_enter(iclog->ic_trace,
165 (void *)((unsigned long)state), 186 (void *)((unsigned long)state),
166 (void *)((unsigned long)current_pid()), 187 (void *)((unsigned long)current_pid()),
@@ -170,8 +191,15 @@ xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
170 (void *)NULL, (void *)NULL); 191 (void *)NULL, (void *)NULL);
171} 192}
172#else 193#else
194
195#define xlog_trace_loggrant_alloc(log)
196#define xlog_trace_loggrant_dealloc(log)
173#define xlog_trace_loggrant(log,tic,string) 197#define xlog_trace_loggrant(log,tic,string)
198
199#define xlog_trace_iclog_alloc(iclog)
200#define xlog_trace_iclog_dealloc(iclog)
174#define xlog_trace_iclog(iclog,state) 201#define xlog_trace_iclog(iclog,state)
202
175#endif /* XFS_LOG_TRACE */ 203#endif /* XFS_LOG_TRACE */
176 204
177 205
@@ -1009,7 +1037,7 @@ xlog_iodone(xfs_buf_t *bp)
1009 * layer, it means the underlyin device no longer supports 1037 * layer, it means the underlyin device no longer supports
1010 * barrier I/O. Warn loudly and turn off barriers. 1038 * barrier I/O. Warn loudly and turn off barriers.
1011 */ 1039 */
1012 if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) { 1040 if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ISORDERED(bp)) {
1013 l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER; 1041 l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
1014 xfs_fs_cmn_err(CE_WARN, l->l_mp, 1042 xfs_fs_cmn_err(CE_WARN, l->l_mp,
1015 "xlog_iodone: Barriers are no longer supported" 1043 "xlog_iodone: Barriers are no longer supported"
@@ -1231,6 +1259,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1231 spin_lock_init(&log->l_grant_lock); 1259 spin_lock_init(&log->l_grant_lock);
1232 sv_init(&log->l_flush_wait, 0, "flush_wait"); 1260 sv_init(&log->l_flush_wait, 0, "flush_wait");
1233 1261
1262 xlog_trace_loggrant_alloc(log);
1234 /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */ 1263 /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */
1235 ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0); 1264 ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0);
1236 1265
@@ -1285,6 +1314,8 @@ xlog_alloc_log(xfs_mount_t *mp,
1285 sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force"); 1314 sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force");
1286 sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write"); 1315 sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write");
1287 1316
1317 xlog_trace_iclog_alloc(iclog);
1318
1288 iclogp = &iclog->ic_next; 1319 iclogp = &iclog->ic_next;
1289 } 1320 }
1290 *iclogp = log->l_iclog; /* complete ring */ 1321 *iclogp = log->l_iclog; /* complete ring */
@@ -1565,11 +1596,7 @@ xlog_dealloc_log(xlog_t *log)
1565 sv_destroy(&iclog->ic_force_wait); 1596 sv_destroy(&iclog->ic_force_wait);
1566 sv_destroy(&iclog->ic_write_wait); 1597 sv_destroy(&iclog->ic_write_wait);
1567 xfs_buf_free(iclog->ic_bp); 1598 xfs_buf_free(iclog->ic_bp);
1568#ifdef XFS_LOG_TRACE 1599 xlog_trace_iclog_dealloc(iclog);
1569 if (iclog->ic_trace != NULL) {
1570 ktrace_free(iclog->ic_trace);
1571 }
1572#endif
1573 next_iclog = iclog->ic_next; 1600 next_iclog = iclog->ic_next;
1574 kmem_free(iclog); 1601 kmem_free(iclog);
1575 iclog = next_iclog; 1602 iclog = next_iclog;
@@ -1578,14 +1605,7 @@ xlog_dealloc_log(xlog_t *log)
1578 spinlock_destroy(&log->l_grant_lock); 1605 spinlock_destroy(&log->l_grant_lock);
1579 1606
1580 xfs_buf_free(log->l_xbuf); 1607 xfs_buf_free(log->l_xbuf);
1581#ifdef XFS_LOG_TRACE 1608 xlog_trace_loggrant_dealloc(log);
1582 if (log->l_trace != NULL) {
1583 ktrace_free(log->l_trace);
1584 }
1585 if (log->l_grant_trace != NULL) {
1586 ktrace_free(log->l_grant_trace);
1587 }
1588#endif
1589 log->l_mp->m_log = NULL; 1609 log->l_mp->m_log = NULL;
1590 kmem_free(log); 1610 kmem_free(log);
1591} /* xlog_dealloc_log */ 1611} /* xlog_dealloc_log */
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index c8a5b22ee3e3..e7d8f84443fa 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -448,7 +448,6 @@ typedef struct log {
448 int l_grant_write_bytes; 448 int l_grant_write_bytes;
449 449
450#ifdef XFS_LOG_TRACE 450#ifdef XFS_LOG_TRACE
451 struct ktrace *l_trace;
452 struct ktrace *l_grant_trace; 451 struct ktrace *l_grant_trace;
453#endif 452#endif
454 453
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index aa238c8fbd7a..8b6812f66a15 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1838,6 +1838,12 @@ again:
1838#endif 1838#endif
1839} 1839}
1840 1840
1841/*
1842 * xfs_lock_two_inodes() can only be used to lock one type of lock
1843 * at a time - the iolock or the ilock, but not both at once. If
1844 * we lock both at once, lockdep will report false positives saying
1845 * we have violated locking orders.
1846 */
1841void 1847void
1842xfs_lock_two_inodes( 1848xfs_lock_two_inodes(
1843 xfs_inode_t *ip0, 1849 xfs_inode_t *ip0,
@@ -1848,6 +1854,8 @@ xfs_lock_two_inodes(
1848 int attempts = 0; 1854 int attempts = 0;
1849 xfs_log_item_t *lp; 1855 xfs_log_item_t *lp;
1850 1856
1857 if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL))
1858 ASSERT((lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) == 0);
1851 ASSERT(ip0->i_ino != ip1->i_ino); 1859 ASSERT(ip0->i_ino != ip1->i_ino);
1852 1860
1853 if (ip0->i_ino > ip1->i_ino) { 1861 if (ip0->i_ino > ip1->i_ino) {
@@ -3152,6 +3160,13 @@ error1: /* Just cancel transaction */
3152/* 3160/*
3153 * Zero file bytes between startoff and endoff inclusive. 3161 * Zero file bytes between startoff and endoff inclusive.
3154 * The iolock is held exclusive and no blocks are buffered. 3162 * The iolock is held exclusive and no blocks are buffered.
3163 *
3164 * This function is used by xfs_free_file_space() to zero
3165 * partial blocks when the range to free is not block aligned.
3166 * When unreserving space with boundaries that are not block
3167 * aligned we round up the start and round down the end
3168 * boundaries and then use this function to zero the parts of
3169 * the blocks that got dropped during the rounding.
3155 */ 3170 */
3156STATIC int 3171STATIC int
3157xfs_zero_remaining_bytes( 3172xfs_zero_remaining_bytes(
@@ -3168,6 +3183,17 @@ xfs_zero_remaining_bytes(
3168 int nimap; 3183 int nimap;
3169 int error = 0; 3184 int error = 0;
3170 3185
3186 /*
3187 * Avoid doing I/O beyond eof - it's not necessary
3188 * since nothing can read beyond eof. The space will
3189 * be zeroed when the file is extended anyway.
3190 */
3191 if (startoff >= ip->i_size)
3192 return 0;
3193
3194 if (endoff > ip->i_size)
3195 endoff = ip->i_size;
3196
3171 bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize, 3197 bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
3172 XFS_IS_REALTIME_INODE(ip) ? 3198 XFS_IS_REALTIME_INODE(ip) ?
3173 mp->m_rtdev_targp : mp->m_ddev_targp); 3199 mp->m_rtdev_targp : mp->m_ddev_targp);
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index a3f738cffdb6..edc6ba82e090 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -97,6 +97,16 @@ extern void warn_slowpath(const char *file, const int line,
97 unlikely(__ret_warn_once); \ 97 unlikely(__ret_warn_once); \
98}) 98})
99 99
100#define WARN_ONCE(condition, format...) ({ \
101 static int __warned; \
102 int __ret_warn_once = !!(condition); \
103 \
104 if (unlikely(__ret_warn_once)) \
105 if (WARN(!__warned, format)) \
106 __warned = 1; \
107 unlikely(__ret_warn_once); \
108})
109
100#define WARN_ON_RATELIMIT(condition, state) \ 110#define WARN_ON_RATELIMIT(condition, state) \
101 WARN_ON((condition) && __ratelimit(state)) 111 WARN_ON((condition) && __ratelimit(state))
102 112
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 580b513668fe..27cfa723b92a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -942,6 +942,14 @@ struct lock_manager_operations {
942 int (*fl_change)(struct file_lock **, int); 942 int (*fl_change)(struct file_lock **, int);
943}; 943};
944 944
945struct lock_manager {
946 struct list_head list;
947};
948
949void locks_start_grace(struct lock_manager *);
950void locks_end_grace(struct lock_manager *);
951int locks_in_grace(void);
952
945/* that will die - we need it for nfs_lock_info */ 953/* that will die - we need it for nfs_lock_info */
946#include <linux/nfs_fs_i.h> 954#include <linux/nfs_fs_i.h>
947 955
@@ -983,6 +991,13 @@ struct file_lock {
983 991
984#include <linux/fcntl.h> 992#include <linux/fcntl.h>
985 993
994extern void send_sigio(struct fown_struct *fown, int fd, int band);
995
996/* fs/sync.c */
997extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
998 loff_t endbyte, unsigned int flags);
999
1000#ifdef CONFIG_FILE_LOCKING
986extern int fcntl_getlk(struct file *, struct flock __user *); 1001extern int fcntl_getlk(struct file *, struct flock __user *);
987extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1002extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
988 struct flock __user *); 1003 struct flock __user *);
@@ -993,14 +1008,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
993 struct flock64 __user *); 1008 struct flock64 __user *);
994#endif 1009#endif
995 1010
996extern void send_sigio(struct fown_struct *fown, int fd, int band);
997extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 1011extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
998extern int fcntl_getlease(struct file *filp); 1012extern int fcntl_getlease(struct file *filp);
999 1013
1000/* fs/sync.c */
1001extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1002 loff_t endbyte, unsigned int flags);
1003
1004/* fs/locks.c */ 1014/* fs/locks.c */
1005extern void locks_init_lock(struct file_lock *); 1015extern void locks_init_lock(struct file_lock *);
1006extern void locks_copy_lock(struct file_lock *, struct file_lock *); 1016extern void locks_copy_lock(struct file_lock *, struct file_lock *);
@@ -1023,6 +1033,37 @@ extern int lease_modify(struct file_lock **, int);
1023extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1033extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1024extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1034extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1025extern struct seq_operations locks_seq_operations; 1035extern struct seq_operations locks_seq_operations;
1036#else /* !CONFIG_FILE_LOCKING */
1037#define fcntl_getlk(a, b) ({ -EINVAL; })
1038#define fcntl_setlk(a, b, c, d) ({ -EACCES; })
1039#if BITS_PER_LONG == 32
1040#define fcntl_getlk64(a, b) ({ -EINVAL; })
1041#define fcntl_setlk64(a, b, c, d) ({ -EACCES; })
1042#endif
1043#define fcntl_setlease(a, b, c) ({ 0; })
1044#define fcntl_getlease(a) ({ 0; })
1045#define locks_init_lock(a) ({ })
1046#define __locks_copy_lock(a, b) ({ })
1047#define locks_copy_lock(a, b) ({ })
1048#define locks_remove_posix(a, b) ({ })
1049#define locks_remove_flock(a) ({ })
1050#define posix_test_lock(a, b) ({ 0; })
1051#define posix_lock_file(a, b, c) ({ -ENOLCK; })
1052#define posix_lock_file_wait(a, b) ({ -ENOLCK; })
1053#define posix_unblock_lock(a, b) (-ENOENT)
1054#define vfs_test_lock(a, b) ({ 0; })
1055#define vfs_lock_file(a, b, c, d) (-ENOLCK)
1056#define vfs_cancel_lock(a, b) ({ 0; })
1057#define flock_lock_file_wait(a, b) ({ -ENOLCK; })
1058#define __break_lease(a, b) ({ 0; })
1059#define lease_get_mtime(a, b) ({ })
1060#define generic_setlease(a, b, c) ({ -EINVAL; })
1061#define vfs_setlease(a, b, c) ({ -EINVAL; })
1062#define lease_modify(a, b) ({ -EINVAL; })
1063#define lock_may_read(a, b, c) ({ 1; })
1064#define lock_may_write(a, b, c) ({ 1; })
1065#endif /* !CONFIG_FILE_LOCKING */
1066
1026 1067
1027struct fasync_struct { 1068struct fasync_struct {
1028 int magic; 1069 int magic;
@@ -1554,9 +1595,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *);
1554/* /sys/fs */ 1595/* /sys/fs */
1555extern struct kobject *fs_kobj; 1596extern struct kobject *fs_kobj;
1556 1597
1598extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1599
1557#define FLOCK_VERIFY_READ 1 1600#define FLOCK_VERIFY_READ 1
1558#define FLOCK_VERIFY_WRITE 2 1601#define FLOCK_VERIFY_WRITE 2
1559 1602
1603#ifdef CONFIG_FILE_LOCKING
1560extern int locks_mandatory_locked(struct inode *); 1604extern int locks_mandatory_locked(struct inode *);
1561extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1605extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1562 1606
@@ -1587,8 +1631,6 @@ static inline int locks_verify_locked(struct inode *inode)
1587 return 0; 1631 return 0;
1588} 1632}
1589 1633
1590extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1591
1592static inline int locks_verify_truncate(struct inode *inode, 1634static inline int locks_verify_truncate(struct inode *inode,
1593 struct file *filp, 1635 struct file *filp,
1594 loff_t size) 1636 loff_t size)
@@ -1609,6 +1651,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1609 return __break_lease(inode, mode); 1651 return __break_lease(inode, mode);
1610 return 0; 1652 return 0;
1611} 1653}
1654#else /* !CONFIG_FILE_LOCKING */
1655#define locks_mandatory_locked(a) ({ 0; })
1656#define locks_mandatory_area(a, b, c, d, e) ({ 0; })
1657#define __mandatory_lock(a) ({ 0; })
1658#define mandatory_lock(a) ({ 0; })
1659#define locks_verify_locked(a) ({ 0; })
1660#define locks_verify_truncate(a, b, c) ({ 0; })
1661#define break_lease(a, b) ({ 0; })
1662#endif /* CONFIG_FILE_LOCKING */
1612 1663
1613/* fs/open.c */ 1664/* fs/open.c */
1614 1665
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 3d25bcd139d1..e5872dc994c0 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -27,7 +27,6 @@ struct nlmsvc_binding {
27 struct nfs_fh *, 27 struct nfs_fh *,
28 struct file **); 28 struct file **);
29 void (*fclose)(struct file *); 29 void (*fclose)(struct file *);
30 unsigned long (*get_grace_period)(void);
31}; 30};
32 31
33extern struct nlmsvc_binding * nlmsvc_ops; 32extern struct nlmsvc_binding * nlmsvc_ops;
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host);
53 52
54extern int nlmclnt_proc(struct nlm_host *host, int cmd, 53extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl); 54 struct file_lock *fl);
56extern int lockd_up(int proto); 55extern int lockd_up(void);
57extern void lockd_down(void); 56extern void lockd_down(void);
58 57
59unsigned long get_nfs_grace_period(void);
60
61#ifdef CONFIG_NFSD_V4
62unsigned long get_nfs4_grace_period(void);
63#else
64static inline unsigned long get_nfs4_grace_period(void) {return 0;}
65#endif
66
67#endif /* LINUX_LOCKD_BIND_H */ 58#endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index dbb87ab282e8..b56d5aa9b194 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -12,6 +12,8 @@
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/in6.h>
16#include <net/ipv6.h>
15#include <linux/fs.h> 17#include <linux/fs.h>
16#include <linux/kref.h> 18#include <linux/kref.h>
17#include <linux/utsname.h> 19#include <linux/utsname.h>
@@ -38,8 +40,9 @@
38 */ 40 */
39struct nlm_host { 41struct nlm_host {
40 struct hlist_node h_hash; /* doubly linked list */ 42 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_in h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
42 struct sockaddr_in h_saddr; /* our address (optional) */ 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
43 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 46 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
44 char * h_name; /* remote hostname */ 47 char * h_name; /* remote hostname */
45 u32 h_version; /* interface version */ 48 u32 h_version; /* interface version */
@@ -61,18 +64,56 @@ struct nlm_host {
61 struct list_head h_granted; /* Locks in GRANTED state */ 64 struct list_head h_granted; /* Locks in GRANTED state */
62 struct list_head h_reclaim; /* Locks in RECLAIM state */ 65 struct list_head h_reclaim; /* Locks in RECLAIM state */
63 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 66 struct nsm_handle * h_nsmhandle; /* NSM status handle */
67
68 char h_addrbuf[48], /* address eyecatchers */
69 h_srcaddrbuf[48];
64}; 70};
65 71
66struct nsm_handle { 72struct nsm_handle {
67 struct list_head sm_link; 73 struct list_head sm_link;
68 atomic_t sm_count; 74 atomic_t sm_count;
69 char * sm_name; 75 char * sm_name;
70 struct sockaddr_in sm_addr; 76 struct sockaddr_storage sm_addr;
77 size_t sm_addrlen;
71 unsigned int sm_monitored : 1, 78 unsigned int sm_monitored : 1,
72 sm_sticky : 1; /* don't unmonitor */ 79 sm_sticky : 1; /* don't unmonitor */
80 char sm_addrbuf[48]; /* address eyecatcher */
73}; 81};
74 82
75/* 83/*
84 * Rigorous type checking on sockaddr type conversions
85 */
86static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host)
87{
88 return (struct sockaddr_in *)&host->h_addr;
89}
90
91static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
92{
93 return (struct sockaddr *)&host->h_addr;
94}
95
96static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host)
97{
98 return (struct sockaddr_in *)&host->h_srcaddr;
99}
100
101static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
102{
103 return (struct sockaddr *)&host->h_srcaddr;
104}
105
106static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
107{
108 return (struct sockaddr_in *)&handle->sm_addr;
109}
110
111static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
112{
113 return (struct sockaddr *)&handle->sm_addr;
114}
115
116/*
76 * Map an fl_owner_t into a unique 32-bit "pid" 117 * Map an fl_owner_t into a unique 32-bit "pid"
77 */ 118 */
78struct nlm_lockowner { 119struct nlm_lockowner {
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
166struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 207struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
167void nlmclnt_finish_block(struct nlm_wait *block); 208void nlmclnt_finish_block(struct nlm_wait *block);
168int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 209int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
169__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 210__be32 nlmclnt_grant(const struct sockaddr *addr,
211 const struct nlm_lock *lock);
170void nlmclnt_recovery(struct nlm_host *); 212void nlmclnt_recovery(struct nlm_host *);
171int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 213int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
172void nlmclnt_next_cookie(struct nlm_cookie *); 214void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
174/* 216/*
175 * Host cache 217 * Host cache
176 */ 218 */
177struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, 219struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
178 int proto, u32 version, 220 const size_t salen,
221 const unsigned short protocol,
222 const u32 version,
223 const char *hostname);
224struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
179 const char *hostname, 225 const char *hostname,
180 unsigned int hostname_len); 226 const size_t hostname_len);
181struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
182 unsigned int);
183struct rpc_clnt * nlm_bind_host(struct nlm_host *); 227struct rpc_clnt * nlm_bind_host(struct nlm_host *);
184void nlm_rebind_host(struct nlm_host *); 228void nlm_rebind_host(struct nlm_host *);
185struct nlm_host * nlm_get_host(struct nlm_host *); 229struct nlm_host * nlm_get_host(struct nlm_host *);
@@ -201,7 +245,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
201 */ 245 */
202__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 246__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
203 struct nlm_host *, struct nlm_lock *, int, 247 struct nlm_host *, struct nlm_lock *, int,
204 struct nlm_cookie *); 248 struct nlm_cookie *, int);
205__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 249__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
206__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, 250__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
207 struct nlm_host *, struct nlm_lock *, 251 struct nlm_host *, struct nlm_lock *,
@@ -233,15 +277,82 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
233 return file->f_file->f_path.dentry->d_inode; 277 return file->f_file->f_path.dentry->d_inode;
234} 278}
235 279
280static inline int __nlm_privileged_request4(const struct sockaddr *sap)
281{
282 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
283 return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
284 (ntohs(sin->sin_port) < 1024);
285}
286
287#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
288static inline int __nlm_privileged_request6(const struct sockaddr *sap)
289{
290 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
291 return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) &&
292 (ntohs(sin6->sin6_port) < 1024);
293}
294#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
295static inline int __nlm_privileged_request6(const struct sockaddr *sap)
296{
297 return 0;
298}
299#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
300
236/* 301/*
237 * Compare two host addresses (needs modifying for ipv6) 302 * Ensure incoming requests are from local privileged callers.
303 *
304 * Return TRUE if sender is local and is connecting via a privileged port;
305 * otherwise return FALSE.
238 */ 306 */
239static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, 307static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
240 const struct sockaddr_in *sin2)
241{ 308{
309 const struct sockaddr *sap = svc_addr(rqstp);
310
311 switch (sap->sa_family) {
312 case AF_INET:
313 return __nlm_privileged_request4(sap);
314 case AF_INET6:
315 return __nlm_privileged_request6(sap);
316 default:
317 return 0;
318 }
319}
320
321static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
322 const struct sockaddr *sap2)
323{
324 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
325 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
242 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 326 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
243} 327}
244 328
329static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
330 const struct sockaddr *sap2)
331{
332 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
333 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
334 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
335}
336
337/*
338 * Compare two host addresses
339 *
340 * Return TRUE if the addresses are the same; otherwise FALSE.
341 */
342static inline int nlm_cmp_addr(const struct sockaddr *sap1,
343 const struct sockaddr *sap2)
344{
345 if (sap1->sa_family == sap2->sa_family) {
346 switch (sap1->sa_family) {
347 case AF_INET:
348 return __nlm_cmp_addr4(sap1, sap2);
349 case AF_INET6:
350 return __nlm_cmp_addr6(sap1, sap2);
351 }
352 }
353 return 0;
354}
355
245/* 356/*
246 * Compare two NLM locks. 357 * Compare two NLM locks.
247 * When the second lock is of type F_UNLCK, this acts like a wildcard. 358 * When the second lock is of type F_UNLCK, this acts like a wildcard.
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index df18fa053bcd..d6b3a802c046 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -81,8 +81,6 @@ struct nlm_reboot {
81 unsigned int len; 81 unsigned int len;
82 u32 state; 82 u32 state;
83 __be32 addr; 83 __be32 addr;
84 __be32 vers;
85 __be32 proto;
86}; 84};
87 85
88/* 86/*
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 655ea0d1ee14..b2f944468313 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -141,6 +141,10 @@ enum {
141 MLX4_STAT_RATE_OFFSET = 5 141 MLX4_STAT_RATE_OFFSET = 5
142}; 142};
143 143
144enum {
145 MLX4_MTT_FLAG_PRESENT = 1
146};
147
144static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 148static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
145{ 149{
146 return (major << 32) | (minor << 16) | subminor; 150 return (major << 32) | (minor << 16) | subminor;
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 108f47e5fd95..21269405ffe2 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -38,6 +38,7 @@
38#define NFSD_MAY_LOCK 32 38#define NFSD_MAY_LOCK 32
39#define NFSD_MAY_OWNER_OVERRIDE 64 39#define NFSD_MAY_OWNER_OVERRIDE 64
40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ 40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
41#define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
41 42
42#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) 43#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
43#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) 44#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
125__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, 126__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
126 loff_t *, struct readdir_cd *, filldir_t); 127 loff_t *, struct readdir_cd *, filldir_t);
127__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, 128__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
128 struct kstatfs *); 129 struct kstatfs *, int access);
129 130
130int nfsd_notify_change(struct inode *, struct iattr *); 131int nfsd_notify_change(struct inode *, struct iattr *);
131__be32 nfsd_permission(struct svc_rqst *, struct svc_export *, 132__be32 nfsd_permission(struct svc_rqst *, struct svc_export *,
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1ce54b63085d..be764e514e35 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -21,7 +21,14 @@ struct pnp_dev;
21/* 21/*
22 * Resource Management 22 * Resource Management
23 */ 23 */
24#ifdef CONFIG_PNP
24struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); 25struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
26#else
27static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num)
28{
29 return NULL;
30}
31#endif
25 32
26static inline int pnp_resource_valid(struct resource *res) 33static inline int pnp_resource_valid(struct resource *res)
27{ 34{
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index e5bfe01ee305..6f0ee1b84a4f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -104,6 +104,7 @@ struct rpc_create_args {
104 const struct rpc_timeout *timeout; 104 const struct rpc_timeout *timeout;
105 char *servername; 105 char *servername;
106 struct rpc_program *program; 106 struct rpc_program *program;
107 u32 prognumber; /* overrides program->number */
107 u32 version; 108 u32 version;
108 rpc_authflavor_t authflavor; 109 rpc_authflavor_t authflavor;
109 unsigned long flags; 110 unsigned long flags;
@@ -124,10 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
124void rpc_shutdown_client(struct rpc_clnt *); 125void rpc_shutdown_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 126void rpc_release_client(struct rpc_clnt *);
126 127
127int rpcb_register(u32, u32, int, unsigned short, int *); 128int rpcb_register(u32, u32, int, unsigned short);
128int rpcb_v4_register(const u32 program, const u32 version, 129int rpcb_v4_register(const u32 program, const u32 version,
129 const struct sockaddr *address, 130 const struct sockaddr *address,
130 const char *netid, int *result); 131 const char *netid);
131int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); 132int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
132void rpcb_getport_async(struct rpc_task *); 133void rpcb_getport_async(struct rpc_task *);
133 134
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index dc69068d94c7..3afe7fb403b2 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -66,6 +66,7 @@ struct svc_serv {
66 struct list_head sv_tempsocks; /* all temporary sockets */ 66 struct list_head sv_tempsocks; /* all temporary sockets */
67 int sv_tmpcnt; /* count of temporary sockets */ 67 int sv_tmpcnt; /* count of temporary sockets */
68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */ 68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
69 sa_family_t sv_family; /* listener's address family */
69 70
70 char * sv_name; /* service name */ 71 char * sv_name; /* service name */
71 72
@@ -265,17 +266,17 @@ struct svc_rqst {
265/* 266/*
266 * Rigorous type checking on sockaddr type conversions 267 * Rigorous type checking on sockaddr type conversions
267 */ 268 */
268static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) 269static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst)
269{ 270{
270 return (struct sockaddr_in *) &rqst->rq_addr; 271 return (struct sockaddr_in *) &rqst->rq_addr;
271} 272}
272 273
273static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) 274static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst)
274{ 275{
275 return (struct sockaddr_in6 *) &rqst->rq_addr; 276 return (struct sockaddr_in6 *) &rqst->rq_addr;
276} 277}
277 278
278static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) 279static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst)
279{ 280{
280 return (struct sockaddr *) &rqst->rq_addr; 281 return (struct sockaddr *) &rqst->rq_addr;
281} 282}
@@ -381,18 +382,20 @@ struct svc_procedure {
381/* 382/*
382 * Function prototypes. 383 * Function prototypes.
383 */ 384 */
384struct svc_serv * svc_create(struct svc_program *, unsigned int, 385struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t,
385 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv *));
386struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
387 struct svc_pool *pool); 388 struct svc_pool *pool);
388void svc_exit_thread(struct svc_rqst *); 389void svc_exit_thread(struct svc_rqst *);
389struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 390struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
390 void (*shutdown)(struct svc_serv*), svc_thread_fn, 391 sa_family_t, void (*shutdown)(struct svc_serv *),
391 struct module *); 392 svc_thread_fn, struct module *);
392int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 393int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
393void svc_destroy(struct svc_serv *); 394void svc_destroy(struct svc_serv *);
394int svc_process(struct svc_rqst *); 395int svc_process(struct svc_rqst *);
395int svc_register(struct svc_serv *, int, unsigned short); 396int svc_register(const struct svc_serv *, const unsigned short,
397 const unsigned short);
398
396void svc_wake_up(struct svc_serv *); 399void svc_wake_up(struct svc_serv *);
397void svc_reserve(struct svc_rqst *rqstp, int space); 400void svc_reserve(struct svc_rqst *rqstp, int space);
398struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); 401struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 8cff696dedf5..483e10380aae 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *);
39void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
40void svc_sock_update_bufs(struct svc_serv *serv); 40void svc_sock_update_bufs(struct svc_serv *serv);
41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); 41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
42int svc_addsock(struct svc_serv *serv, 42int svc_addsock(struct svc_serv *serv, int fd, char *name_return);
43 int fd,
44 char *name_return,
45 int *proto);
46void svc_init_xprt_sock(void); 43void svc_init_xprt_sock(void);
47void svc_cleanup_xprt_sock(void); 44void svc_cleanup_xprt_sock(void);
48 45
diff --git a/kernel/sched.c b/kernel/sched.c
index cc1f81b50b82..98890807375b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8909,6 +8909,9 @@ static int sched_rt_global_constraints(void)
8909 u64 rt_runtime, rt_period; 8909 u64 rt_runtime, rt_period;
8910 int ret = 0; 8910 int ret = 0;
8911 8911
8912 if (sysctl_sched_rt_period <= 0)
8913 return -EINVAL;
8914
8912 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); 8915 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period);
8913 rt_runtime = tg->rt_bandwidth.rt_runtime; 8916 rt_runtime = tg->rt_bandwidth.rt_runtime;
8914 8917
@@ -8925,6 +8928,9 @@ static int sched_rt_global_constraints(void)
8925 unsigned long flags; 8928 unsigned long flags;
8926 int i; 8929 int i;
8927 8930
8931 if (sysctl_sched_rt_period <= 0)
8932 return -EINVAL;
8933
8928 spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); 8934 spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
8929 for_each_possible_cpu(i) { 8935 for_each_possible_cpu(i) {
8930 struct rt_rq *rt_rq = &cpu_rq(i)->rt; 8936 struct rt_rq *rt_rq = &cpu_rq(i)->rt;
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 552310798dad..1113157b2058 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -350,6 +350,7 @@ static void __enable_runtime(struct rq *rq)
350 spin_lock(&rt_rq->rt_runtime_lock); 350 spin_lock(&rt_rq->rt_runtime_lock);
351 rt_rq->rt_runtime = rt_b->rt_runtime; 351 rt_rq->rt_runtime = rt_b->rt_runtime;
352 rt_rq->rt_time = 0; 352 rt_rq->rt_time = 0;
353 rt_rq->rt_throttled = 0;
353 spin_unlock(&rt_rq->rt_runtime_lock); 354 spin_unlock(&rt_rq->rt_runtime_lock);
354 spin_unlock(&rt_b->rt_runtime_lock); 355 spin_unlock(&rt_b->rt_runtime_lock);
355 } 356 }
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 08d6e1bb99ac..503d8d4eb80a 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -125,6 +125,7 @@ cond_syscall(sys_vm86old);
125cond_syscall(sys_vm86); 125cond_syscall(sys_vm86);
126cond_syscall(compat_sys_ipc); 126cond_syscall(compat_sys_ipc);
127cond_syscall(compat_sys_sysctl); 127cond_syscall(compat_sys_sysctl);
128cond_syscall(sys_flock);
128 129
129/* arch-specific weak syscall entries */ 130/* arch-specific weak syscall entries */
130cond_syscall(sys_pciconfig_read); 131cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 50ec0886fa3d..4588b2cf2ecb 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -97,7 +97,7 @@ static int sixty = 60;
97static int neg_one = -1; 97static int neg_one = -1;
98#endif 98#endif
99 99
100#ifdef CONFIG_MMU 100#if defined(CONFIG_MMU) && defined(CONFIG_FILE_LOCKING)
101static int two = 2; 101static int two = 2;
102#endif 102#endif
103 103
@@ -1261,6 +1261,7 @@ static struct ctl_table fs_table[] = {
1261 .extra1 = &minolduid, 1261 .extra1 = &minolduid,
1262 .extra2 = &maxolduid, 1262 .extra2 = &maxolduid,
1263 }, 1263 },
1264#ifdef CONFIG_FILE_LOCKING
1264 { 1265 {
1265 .ctl_name = FS_LEASES, 1266 .ctl_name = FS_LEASES,
1266 .procname = "leases-enable", 1267 .procname = "leases-enable",
@@ -1269,6 +1270,7 @@ static struct ctl_table fs_table[] = {
1269 .mode = 0644, 1270 .mode = 0644,
1270 .proc_handler = &proc_dointvec, 1271 .proc_handler = &proc_dointvec,
1271 }, 1272 },
1273#endif
1272#ifdef CONFIG_DNOTIFY 1274#ifdef CONFIG_DNOTIFY
1273 { 1275 {
1274 .ctl_name = FS_DIR_NOTIFY, 1276 .ctl_name = FS_DIR_NOTIFY,
@@ -1280,6 +1282,7 @@ static struct ctl_table fs_table[] = {
1280 }, 1282 },
1281#endif 1283#endif
1282#ifdef CONFIG_MMU 1284#ifdef CONFIG_MMU
1285#ifdef CONFIG_FILE_LOCKING
1283 { 1286 {
1284 .ctl_name = FS_LEASE_TIME, 1287 .ctl_name = FS_LEASE_TIME,
1285 .procname = "lease-break-time", 1288 .procname = "lease-break-time",
@@ -1291,6 +1294,7 @@ static struct ctl_table fs_table[] = {
1291 .extra1 = &zero, 1294 .extra1 = &zero,
1292 .extra2 = &two, 1295 .extra2 = &two,
1293 }, 1296 },
1297#endif
1294 { 1298 {
1295 .procname = "aio-nr", 1299 .procname = "aio-nr",
1296 .data = &aio_nr, 1300 .data = &aio_nr,
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 1876b526c778..f8d968063cea 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -72,6 +72,16 @@ void clockevents_set_mode(struct clock_event_device *dev,
72} 72}
73 73
74/** 74/**
75 * clockevents_shutdown - shutdown the device and clear next_event
76 * @dev: device to shutdown
77 */
78void clockevents_shutdown(struct clock_event_device *dev)
79{
80 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
81 dev->next_event.tv64 = KTIME_MAX;
82}
83
84/**
75 * clockevents_program_event - Reprogram the clock event device. 85 * clockevents_program_event - Reprogram the clock event device.
76 * @expires: absolute expiry time (monotonic clock) 86 * @expires: absolute expiry time (monotonic clock)
77 * 87 *
@@ -206,7 +216,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
206 216
207 if (new) { 217 if (new) {
208 BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED); 218 BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED);
209 clockevents_set_mode(new, CLOCK_EVT_MODE_SHUTDOWN); 219 clockevents_shutdown(new);
210 } 220 }
211 local_irq_restore(flags); 221 local_irq_restore(flags);
212} 222}
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 2f5a38294bf9..f1f3eee28113 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -236,8 +236,7 @@ static void tick_do_broadcast_on_off(void *why)
236 if (!cpu_isset(cpu, tick_broadcast_mask)) { 236 if (!cpu_isset(cpu, tick_broadcast_mask)) {
237 cpu_set(cpu, tick_broadcast_mask); 237 cpu_set(cpu, tick_broadcast_mask);
238 if (td->mode == TICKDEV_MODE_PERIODIC) 238 if (td->mode == TICKDEV_MODE_PERIODIC)
239 clockevents_set_mode(dev, 239 clockevents_shutdown(dev);
240 CLOCK_EVT_MODE_SHUTDOWN);
241 } 240 }
242 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE) 241 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
243 tick_broadcast_force = 1; 242 tick_broadcast_force = 1;
@@ -254,7 +253,7 @@ static void tick_do_broadcast_on_off(void *why)
254 253
255 if (cpus_empty(tick_broadcast_mask)) { 254 if (cpus_empty(tick_broadcast_mask)) {
256 if (!bc_stopped) 255 if (!bc_stopped)
257 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 256 clockevents_shutdown(bc);
258 } else if (bc_stopped) { 257 } else if (bc_stopped) {
259 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) 258 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
260 tick_broadcast_start_periodic(bc); 259 tick_broadcast_start_periodic(bc);
@@ -306,7 +305,7 @@ void tick_shutdown_broadcast(unsigned int *cpup)
306 305
307 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) { 306 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
308 if (bc && cpus_empty(tick_broadcast_mask)) 307 if (bc && cpus_empty(tick_broadcast_mask))
309 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 308 clockevents_shutdown(bc);
310 } 309 }
311 310
312 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 311 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
@@ -321,7 +320,7 @@ void tick_suspend_broadcast(void)
321 320
322 bc = tick_broadcast_device.evtdev; 321 bc = tick_broadcast_device.evtdev;
323 if (bc) 322 if (bc)
324 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 323 clockevents_shutdown(bc);
325 324
326 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 325 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
327} 326}
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index c4777193d567..019315ebf9de 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -249,7 +249,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
249 * not give it back to the clockevents layer ! 249 * not give it back to the clockevents layer !
250 */ 250 */
251 if (tick_is_broadcast_device(curdev)) { 251 if (tick_is_broadcast_device(curdev)) {
252 clockevents_set_mode(curdev, CLOCK_EVT_MODE_SHUTDOWN); 252 clockevents_shutdown(curdev);
253 curdev = NULL; 253 curdev = NULL;
254 } 254 }
255 clockevents_exchange_device(curdev, newdev); 255 clockevents_exchange_device(curdev, newdev);
@@ -311,7 +311,7 @@ static void tick_suspend(void)
311 unsigned long flags; 311 unsigned long flags;
312 312
313 spin_lock_irqsave(&tick_device_lock, flags); 313 spin_lock_irqsave(&tick_device_lock, flags);
314 clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); 314 clockevents_shutdown(td->evtdev);
315 spin_unlock_irqrestore(&tick_device_lock, flags); 315 spin_unlock_irqrestore(&tick_device_lock, flags);
316} 316}
317 317
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 0ffc2918ea6f..6e9db9734aa6 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -10,6 +10,8 @@ extern int tick_do_timer_cpu __read_mostly;
10extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); 10extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
11extern void tick_handle_periodic(struct clock_event_device *dev); 11extern void tick_handle_periodic(struct clock_event_device *dev);
12 12
13extern void clockevents_shutdown(struct clock_event_device *dev);
14
13/* 15/*
14 * NO_HZ / high resolution timer shared code 16 * NO_HZ / high resolution timer shared code
15 */ 17 */
diff --git a/mm/slub.c b/mm/slub.c
index fb486d5540f8..0c83e6afe7b2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1932,6 +1932,7 @@ init_kmem_cache_node(struct kmem_cache_node *n, struct kmem_cache *s)
1932 INIT_LIST_HEAD(&n->partial); 1932 INIT_LIST_HEAD(&n->partial);
1933#ifdef CONFIG_SLUB_DEBUG 1933#ifdef CONFIG_SLUB_DEBUG
1934 atomic_long_set(&n->nr_slabs, 0); 1934 atomic_long_set(&n->nr_slabs, 0);
1935 atomic_long_set(&n->total_objects, 0);
1935 INIT_LIST_HEAD(&n->full); 1936 INIT_LIST_HEAD(&n->full);
1936#endif 1937#endif
1937} 1938}
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8e42fbbd5761..57e26fa66185 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -951,6 +951,27 @@ int udp_disconnect(struct sock *sk, int flags)
951 return 0; 951 return 0;
952} 952}
953 953
954static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
955{
956 int is_udplite = IS_UDPLITE(sk);
957 int rc;
958
959 if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
960 /* Note that an ENOMEM error is charged twice */
961 if (rc == -ENOMEM)
962 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
963 is_udplite);
964 goto drop;
965 }
966
967 return 0;
968
969drop:
970 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
971 kfree_skb(skb);
972 return -1;
973}
974
954/* returns: 975/* returns:
955 * -1: error 976 * -1: error
956 * 0: success 977 * 0: success
@@ -989,9 +1010,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
989 up->encap_rcv != NULL) { 1010 up->encap_rcv != NULL) {
990 int ret; 1011 int ret;
991 1012
992 bh_unlock_sock(sk);
993 ret = (*up->encap_rcv)(sk, skb); 1013 ret = (*up->encap_rcv)(sk, skb);
994 bh_lock_sock(sk);
995 if (ret <= 0) { 1014 if (ret <= 0) {
996 UDP_INC_STATS_BH(sock_net(sk), 1015 UDP_INC_STATS_BH(sock_net(sk),
997 UDP_MIB_INDATAGRAMS, 1016 UDP_MIB_INDATAGRAMS,
@@ -1044,17 +1063,16 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
1044 goto drop; 1063 goto drop;
1045 } 1064 }
1046 1065
1047 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { 1066 rc = 0;
1048 /* Note that an ENOMEM error is charged twice */
1049 if (rc == -ENOMEM) {
1050 UDP_INC_STATS_BH(sock_net(sk),
1051 UDP_MIB_RCVBUFERRORS, is_udplite);
1052 atomic_inc(&sk->sk_drops);
1053 }
1054 goto drop;
1055 }
1056 1067
1057 return 0; 1068 bh_lock_sock(sk);
1069 if (!sock_owned_by_user(sk))
1070 rc = __udp_queue_rcv_skb(sk, skb);
1071 else
1072 sk_add_backlog(sk, skb);
1073 bh_unlock_sock(sk);
1074
1075 return rc;
1058 1076
1059drop: 1077drop:
1060 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 1078 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
@@ -1092,15 +1110,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1092 skb1 = skb_clone(skb, GFP_ATOMIC); 1110 skb1 = skb_clone(skb, GFP_ATOMIC);
1093 1111
1094 if (skb1) { 1112 if (skb1) {
1095 int ret = 0; 1113 int ret = udp_queue_rcv_skb(sk, skb1);
1096
1097 bh_lock_sock(sk);
1098 if (!sock_owned_by_user(sk))
1099 ret = udp_queue_rcv_skb(sk, skb1);
1100 else
1101 sk_add_backlog(sk, skb1);
1102 bh_unlock_sock(sk);
1103
1104 if (ret > 0) 1114 if (ret > 0)
1105 /* we should probably re-process instead 1115 /* we should probably re-process instead
1106 * of dropping packets here. */ 1116 * of dropping packets here. */
@@ -1195,13 +1205,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1195 uh->dest, inet_iif(skb), udptable); 1205 uh->dest, inet_iif(skb), udptable);
1196 1206
1197 if (sk != NULL) { 1207 if (sk != NULL) {
1198 int ret = 0; 1208 int ret = udp_queue_rcv_skb(sk, skb);
1199 bh_lock_sock(sk);
1200 if (!sock_owned_by_user(sk))
1201 ret = udp_queue_rcv_skb(sk, skb);
1202 else
1203 sk_add_backlog(sk, skb);
1204 bh_unlock_sock(sk);
1205 sock_put(sk); 1209 sock_put(sk);
1206 1210
1207 /* a return value > 0 means to resubmit the input, but 1211 /* a return value > 0 means to resubmit the input, but
@@ -1494,7 +1498,7 @@ struct proto udp_prot = {
1494 .sendmsg = udp_sendmsg, 1498 .sendmsg = udp_sendmsg,
1495 .recvmsg = udp_recvmsg, 1499 .recvmsg = udp_recvmsg,
1496 .sendpage = udp_sendpage, 1500 .sendpage = udp_sendpage,
1497 .backlog_rcv = udp_queue_rcv_skb, 1501 .backlog_rcv = __udp_queue_rcv_skb,
1498 .hash = udp_lib_hash, 1502 .hash = udp_lib_hash,
1499 .unhash = udp_lib_unhash, 1503 .unhash = udp_lib_unhash,
1500 .get_port = udp_v4_get_port, 1504 .get_port = udp_v4_get_port,
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 9634091ee2f0..ec0a0839ce51 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -215,10 +215,9 @@ static void dev_watchdog(unsigned long arg)
215 time_after(jiffies, (dev->trans_start + 215 time_after(jiffies, (dev->trans_start +
216 dev->watchdog_timeo))) { 216 dev->watchdog_timeo))) {
217 char drivername[64]; 217 char drivername[64];
218 printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n", 218 WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
219 dev->name, netdev_drivername(dev, drivername, 64)); 219 dev->name, netdev_drivername(dev, drivername, 64));
220 dev->tx_timeout(dev); 220 dev->tx_timeout(dev);
221 WARN_ON_ONCE(1);
222 } 221 }
223 if (!mod_timer(&dev->watchdog_timer, 222 if (!mod_timer(&dev->watchdog_timer,
224 round_jiffies(jiffies + 223 round_jiffies(jiffies +
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 8472b8b349c4..abd51cef2413 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -599,11 +599,12 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
599 /* Check to see if this is a duplicate. */ 599 /* Check to see if this is a duplicate. */
600 peer = sctp_assoc_lookup_paddr(asoc, addr); 600 peer = sctp_assoc_lookup_paddr(asoc, addr);
601 if (peer) { 601 if (peer) {
602 /* An UNKNOWN state is only set on transports added by
603 * user in sctp_connectx() call. Such transports should be
604 * considered CONFIRMED per RFC 4960, Section 5.4.
605 */
602 if (peer->state == SCTP_UNKNOWN) { 606 if (peer->state == SCTP_UNKNOWN) {
603 if (peer_state == SCTP_ACTIVE) 607 peer->state = SCTP_ACTIVE;
604 peer->state = SCTP_ACTIVE;
605 if (peer_state == SCTP_UNCONFIRMED)
606 peer->state = SCTP_UNCONFIRMED;
607 } 608 }
608 return peer; 609 return peer;
609 } 610 }
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 0dc4a7dfb234..225c7123c41f 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -533,7 +533,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
533 if (!(dst->dev->features & NETIF_F_NO_CSUM)) { 533 if (!(dst->dev->features & NETIF_F_NO_CSUM)) {
534 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 534 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
535 crc32 = sctp_end_cksum(crc32); 535 crc32 = sctp_end_cksum(crc32);
536 } 536 } else
537 nskb->ip_summed = CHECKSUM_UNNECESSARY;
537 538
538 /* 3) Put the resultant value into the checksum field in the 539 /* 3) Put the resultant value into the checksum field in the
539 * common header, and leave the rest of the bits unchanged. 540 * common header, and leave the rest of the bits unchanged.
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index e8ca4e54981f..b599cbba4fbe 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1886,11 +1886,13 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1886 /* if the peer reports AUTH, assume that he 1886 /* if the peer reports AUTH, assume that he
1887 * supports AUTH. 1887 * supports AUTH.
1888 */ 1888 */
1889 asoc->peer.auth_capable = 1; 1889 if (sctp_auth_enable)
1890 asoc->peer.auth_capable = 1;
1890 break; 1891 break;
1891 case SCTP_CID_ASCONF: 1892 case SCTP_CID_ASCONF:
1892 case SCTP_CID_ASCONF_ACK: 1893 case SCTP_CID_ASCONF_ACK:
1893 asoc->peer.asconf_capable = 1; 1894 if (sctp_addip_enable)
1895 asoc->peer.asconf_capable = 1;
1894 break; 1896 break;
1895 default: 1897 default:
1896 break; 1898 break;
@@ -2319,12 +2321,10 @@ clean_up:
2319 /* Release the transport structures. */ 2321 /* Release the transport structures. */
2320 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 2322 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
2321 transport = list_entry(pos, struct sctp_transport, transports); 2323 transport = list_entry(pos, struct sctp_transport, transports);
2322 list_del_init(pos); 2324 if (transport->state != SCTP_ACTIVE)
2323 sctp_transport_free(transport); 2325 sctp_assoc_rm_peer(asoc, transport);
2324 } 2326 }
2325 2327
2326 asoc->peer.transport_count = 0;
2327
2328nomem: 2328nomem:
2329 return 0; 2329 return 0;
2330} 2330}
@@ -2460,6 +2460,9 @@ do_addr_param:
2460 break; 2460 break;
2461 2461
2462 case SCTP_PARAM_SET_PRIMARY: 2462 case SCTP_PARAM_SET_PRIMARY:
2463 if (!sctp_addip_enable)
2464 goto fall_through;
2465
2463 addr_param = param.v + sizeof(sctp_addip_param_t); 2466 addr_param = param.v + sizeof(sctp_addip_param_t);
2464 2467
2465 af = sctp_get_af_specific(param_type2af(param.p->type)); 2468 af = sctp_get_af_specific(param_type2af(param.p->type));
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 76739e928d0d..da0789fa1b88 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -174,7 +174,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
174 clnt->cl_procinfo = version->procs; 174 clnt->cl_procinfo = version->procs;
175 clnt->cl_maxproc = version->nrprocs; 175 clnt->cl_maxproc = version->nrprocs;
176 clnt->cl_protname = program->name; 176 clnt->cl_protname = program->name;
177 clnt->cl_prog = program->number; 177 clnt->cl_prog = args->prognumber ? : program->number;
178 clnt->cl_vers = version->number; 178 clnt->cl_vers = version->number;
179 clnt->cl_stats = program->stats; 179 clnt->cl_stats = program->stats;
180 clnt->cl_metrics = rpc_alloc_iostats(clnt); 180 clnt->cl_metrics = rpc_alloc_iostats(clnt);
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 24db2b4d12d3..34abc91058d8 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -20,6 +20,7 @@
20#include <linux/in6.h> 20#include <linux/in6.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <net/ipv6.h>
23 24
24#include <linux/sunrpc/clnt.h> 25#include <linux/sunrpc/clnt.h>
25#include <linux/sunrpc/sched.h> 26#include <linux/sunrpc/sched.h>
@@ -176,13 +177,12 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
176} 177}
177 178
178static int rpcb_register_call(struct sockaddr *addr, size_t addrlen, 179static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
179 u32 version, struct rpc_message *msg, 180 u32 version, struct rpc_message *msg)
180 int *result)
181{ 181{
182 struct rpc_clnt *rpcb_clnt; 182 struct rpc_clnt *rpcb_clnt;
183 int error = 0; 183 int result, error = 0;
184 184
185 *result = 0; 185 msg->rpc_resp = &result;
186 186
187 rpcb_clnt = rpcb_create_local(addr, addrlen, version); 187 rpcb_clnt = rpcb_create_local(addr, addrlen, version);
188 if (!IS_ERR(rpcb_clnt)) { 188 if (!IS_ERR(rpcb_clnt)) {
@@ -191,12 +191,15 @@ static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
191 } else 191 } else
192 error = PTR_ERR(rpcb_clnt); 192 error = PTR_ERR(rpcb_clnt);
193 193
194 if (error < 0) 194 if (error < 0) {
195 printk(KERN_WARNING "RPC: failed to contact local rpcbind " 195 printk(KERN_WARNING "RPC: failed to contact local rpcbind "
196 "server (errno %d).\n", -error); 196 "server (errno %d).\n", -error);
197 dprintk("RPC: registration status %d/%d\n", error, *result); 197 return error;
198 }
198 199
199 return error; 200 if (!result)
201 return -EACCES;
202 return 0;
200} 203}
201 204
202/** 205/**
@@ -205,7 +208,11 @@ static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
205 * @vers: RPC version number to bind 208 * @vers: RPC version number to bind
206 * @prot: transport protocol to register 209 * @prot: transport protocol to register
207 * @port: port value to register 210 * @port: port value to register
208 * @okay: OUT: result code 211 *
212 * Returns zero if the registration request was dispatched successfully
213 * and the rpcbind daemon returned success. Otherwise, returns an errno
214 * value that reflects the nature of the error (request could not be
215 * dispatched, timed out, or rpcbind returned an error).
209 * 216 *
210 * RPC services invoke this function to advertise their contact 217 * RPC services invoke this function to advertise their contact
211 * information via the system's rpcbind daemon. RPC services 218 * information via the system's rpcbind daemon. RPC services
@@ -217,15 +224,6 @@ static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
217 * all registered transports for [program, version] from the local 224 * all registered transports for [program, version] from the local
218 * rpcbind database. 225 * rpcbind database.
219 * 226 *
220 * Returns zero if the registration request was dispatched
221 * successfully and a reply was received. The rpcbind daemon's
222 * boolean result code is stored in *okay.
223 *
224 * Returns an errno value and sets *result to zero if there was
225 * some problem that prevented the rpcbind request from being
226 * dispatched, or if the rpcbind daemon did not respond within
227 * the timeout.
228 *
229 * This function uses rpcbind protocol version 2 to contact the 227 * This function uses rpcbind protocol version 2 to contact the
230 * local rpcbind daemon. 228 * local rpcbind daemon.
231 * 229 *
@@ -236,7 +234,7 @@ static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
236 * IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 234 * IN6ADDR_ANY (ie available for all AF_INET and AF_INET6
237 * addresses). 235 * addresses).
238 */ 236 */
239int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) 237int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port)
240{ 238{
241 struct rpcbind_args map = { 239 struct rpcbind_args map = {
242 .r_prog = prog, 240 .r_prog = prog,
@@ -246,7 +244,6 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
246 }; 244 };
247 struct rpc_message msg = { 245 struct rpc_message msg = {
248 .rpc_argp = &map, 246 .rpc_argp = &map,
249 .rpc_resp = okay,
250 }; 247 };
251 248
252 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " 249 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
@@ -259,7 +256,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
259 256
260 return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback, 257 return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
261 sizeof(rpcb_inaddr_loopback), 258 sizeof(rpcb_inaddr_loopback),
262 RPCBVERS_2, &msg, okay); 259 RPCBVERS_2, &msg);
263} 260}
264 261
265/* 262/*
@@ -290,7 +287,7 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register,
290 287
291 return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback, 288 return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
292 sizeof(rpcb_inaddr_loopback), 289 sizeof(rpcb_inaddr_loopback),
293 RPCBVERS_4, msg, msg->rpc_resp); 290 RPCBVERS_4, msg);
294} 291}
295 292
296/* 293/*
@@ -304,10 +301,13 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
304 char buf[64]; 301 char buf[64];
305 302
306 /* Construct AF_INET6 universal address */ 303 /* Construct AF_INET6 universal address */
307 snprintf(buf, sizeof(buf), 304 if (ipv6_addr_any(&address_to_register->sin6_addr))
308 NIP6_FMT".%u.%u", 305 snprintf(buf, sizeof(buf), "::.%u.%u",
309 NIP6(address_to_register->sin6_addr), 306 port >> 8, port & 0xff);
310 port >> 8, port & 0xff); 307 else
308 snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u",
309 NIP6(address_to_register->sin6_addr),
310 port >> 8, port & 0xff);
311 map->r_addr = buf; 311 map->r_addr = buf;
312 312
313 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " 313 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
@@ -321,7 +321,7 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
321 321
322 return rpcb_register_call((struct sockaddr *)&rpcb_in6addr_loopback, 322 return rpcb_register_call((struct sockaddr *)&rpcb_in6addr_loopback,
323 sizeof(rpcb_in6addr_loopback), 323 sizeof(rpcb_in6addr_loopback),
324 RPCBVERS_4, msg, msg->rpc_resp); 324 RPCBVERS_4, msg);
325} 325}
326 326
327/** 327/**
@@ -330,7 +330,11 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
330 * @version: RPC version number of service to (un)register 330 * @version: RPC version number of service to (un)register
331 * @address: address family, IP address, and port to (un)register 331 * @address: address family, IP address, and port to (un)register
332 * @netid: netid of transport protocol to (un)register 332 * @netid: netid of transport protocol to (un)register
333 * @result: result code from rpcbind RPC call 333 *
334 * Returns zero if the registration request was dispatched successfully
335 * and the rpcbind daemon returned success. Otherwise, returns an errno
336 * value that reflects the nature of the error (request could not be
337 * dispatched, timed out, or rpcbind returned an error).
334 * 338 *
335 * RPC services invoke this function to advertise their contact 339 * RPC services invoke this function to advertise their contact
336 * information via the system's rpcbind daemon. RPC services 340 * information via the system's rpcbind daemon. RPC services
@@ -342,15 +346,6 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
342 * to zero. Callers pass a netid of "" to unregister all 346 * to zero. Callers pass a netid of "" to unregister all
343 * transport netids associated with [program, version, address]. 347 * transport netids associated with [program, version, address].
344 * 348 *
345 * Returns zero if the registration request was dispatched
346 * successfully and a reply was received. The rpcbind daemon's
347 * result code is stored in *result.
348 *
349 * Returns an errno value and sets *result to zero if there was
350 * some problem that prevented the rpcbind request from being
351 * dispatched, or if the rpcbind daemon did not respond within
352 * the timeout.
353 *
354 * This function uses rpcbind protocol version 4 to contact the 349 * This function uses rpcbind protocol version 4 to contact the
355 * local rpcbind daemon. The local rpcbind daemon must support 350 * local rpcbind daemon. The local rpcbind daemon must support
356 * version 4 of the rpcbind protocol in order for these functions 351 * version 4 of the rpcbind protocol in order for these functions
@@ -372,8 +367,7 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
372 * advertises the service on all IPv4 and IPv6 addresses. 367 * advertises the service on all IPv4 and IPv6 addresses.
373 */ 368 */
374int rpcb_v4_register(const u32 program, const u32 version, 369int rpcb_v4_register(const u32 program, const u32 version,
375 const struct sockaddr *address, const char *netid, 370 const struct sockaddr *address, const char *netid)
376 int *result)
377{ 371{
378 struct rpcbind_args map = { 372 struct rpcbind_args map = {
379 .r_prog = program, 373 .r_prog = program,
@@ -383,11 +377,8 @@ int rpcb_v4_register(const u32 program, const u32 version,
383 }; 377 };
384 struct rpc_message msg = { 378 struct rpc_message msg = {
385 .rpc_argp = &map, 379 .rpc_argp = &map,
386 .rpc_resp = result,
387 }; 380 };
388 381
389 *result = 0;
390
391 switch (address->sa_family) { 382 switch (address->sa_family) {
392 case AF_INET: 383 case AF_INET:
393 return rpcb_register_netid4((struct sockaddr_in *)address, 384 return rpcb_register_netid4((struct sockaddr_in *)address,
@@ -633,7 +624,7 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
633static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p, 624static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p,
634 struct rpcbind_args *rpcb) 625 struct rpcbind_args *rpcb)
635{ 626{
636 dprintk("RPC: rpcb_encode_mapping(%u, %u, %d, %u)\n", 627 dprintk("RPC: encoding rpcb request (%u, %u, %d, %u)\n",
637 rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); 628 rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port);
638 *p++ = htonl(rpcb->r_prog); 629 *p++ = htonl(rpcb->r_prog);
639 *p++ = htonl(rpcb->r_vers); 630 *p++ = htonl(rpcb->r_vers);
@@ -648,7 +639,7 @@ static int rpcb_decode_getport(struct rpc_rqst *req, __be32 *p,
648 unsigned short *portp) 639 unsigned short *portp)
649{ 640{
650 *portp = (unsigned short) ntohl(*p++); 641 *portp = (unsigned short) ntohl(*p++);
651 dprintk("RPC: rpcb_decode_getport result %u\n", 642 dprintk("RPC: rpcb getport result: %u\n",
652 *portp); 643 *portp);
653 return 0; 644 return 0;
654} 645}
@@ -657,7 +648,7 @@ static int rpcb_decode_set(struct rpc_rqst *req, __be32 *p,
657 unsigned int *boolp) 648 unsigned int *boolp)
658{ 649{
659 *boolp = (unsigned int) ntohl(*p++); 650 *boolp = (unsigned int) ntohl(*p++);
660 dprintk("RPC: rpcb_decode_set: call %s\n", 651 dprintk("RPC: rpcb set/unset call %s\n",
661 (*boolp ? "succeeded" : "failed")); 652 (*boolp ? "succeeded" : "failed"));
662 return 0; 653 return 0;
663} 654}
@@ -665,7 +656,7 @@ static int rpcb_decode_set(struct rpc_rqst *req, __be32 *p,
665static int rpcb_encode_getaddr(struct rpc_rqst *req, __be32 *p, 656static int rpcb_encode_getaddr(struct rpc_rqst *req, __be32 *p,
666 struct rpcbind_args *rpcb) 657 struct rpcbind_args *rpcb)
667{ 658{
668 dprintk("RPC: rpcb_encode_getaddr(%u, %u, %s)\n", 659 dprintk("RPC: encoding rpcb request (%u, %u, %s)\n",
669 rpcb->r_prog, rpcb->r_vers, rpcb->r_addr); 660 rpcb->r_prog, rpcb->r_vers, rpcb->r_addr);
670 *p++ = htonl(rpcb->r_prog); 661 *p++ = htonl(rpcb->r_prog);
671 *p++ = htonl(rpcb->r_vers); 662 *p++ = htonl(rpcb->r_vers);
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 5a32cb7c4bb4..54c98d876847 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -28,6 +28,8 @@
28 28
29#define RPCDBG_FACILITY RPCDBG_SVCDSP 29#define RPCDBG_FACILITY RPCDBG_SVCDSP
30 30
31static void svc_unregister(const struct svc_serv *serv);
32
31#define svc_serv_is_pooled(serv) ((serv)->sv_function) 33#define svc_serv_is_pooled(serv) ((serv)->sv_function)
32 34
33/* 35/*
@@ -357,7 +359,7 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu)
357 */ 359 */
358static struct svc_serv * 360static struct svc_serv *
359__svc_create(struct svc_program *prog, unsigned int bufsize, int npools, 361__svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
360 void (*shutdown)(struct svc_serv *serv)) 362 sa_family_t family, void (*shutdown)(struct svc_serv *serv))
361{ 363{
362 struct svc_serv *serv; 364 struct svc_serv *serv;
363 unsigned int vers; 365 unsigned int vers;
@@ -366,6 +368,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
366 368
367 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) 369 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL)))
368 return NULL; 370 return NULL;
371 serv->sv_family = family;
369 serv->sv_name = prog->pg_name; 372 serv->sv_name = prog->pg_name;
370 serv->sv_program = prog; 373 serv->sv_program = prog;
371 serv->sv_nrthreads = 1; 374 serv->sv_nrthreads = 1;
@@ -416,30 +419,29 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
416 spin_lock_init(&pool->sp_lock); 419 spin_lock_init(&pool->sp_lock);
417 } 420 }
418 421
419
420 /* Remove any stale portmap registrations */ 422 /* Remove any stale portmap registrations */
421 svc_register(serv, 0, 0); 423 svc_unregister(serv);
422 424
423 return serv; 425 return serv;
424} 426}
425 427
426struct svc_serv * 428struct svc_serv *
427svc_create(struct svc_program *prog, unsigned int bufsize, 429svc_create(struct svc_program *prog, unsigned int bufsize,
428 void (*shutdown)(struct svc_serv *serv)) 430 sa_family_t family, void (*shutdown)(struct svc_serv *serv))
429{ 431{
430 return __svc_create(prog, bufsize, /*npools*/1, shutdown); 432 return __svc_create(prog, bufsize, /*npools*/1, family, shutdown);
431} 433}
432EXPORT_SYMBOL(svc_create); 434EXPORT_SYMBOL(svc_create);
433 435
434struct svc_serv * 436struct svc_serv *
435svc_create_pooled(struct svc_program *prog, unsigned int bufsize, 437svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
436 void (*shutdown)(struct svc_serv *serv), 438 sa_family_t family, void (*shutdown)(struct svc_serv *serv),
437 svc_thread_fn func, struct module *mod) 439 svc_thread_fn func, struct module *mod)
438{ 440{
439 struct svc_serv *serv; 441 struct svc_serv *serv;
440 unsigned int npools = svc_pool_map_get(); 442 unsigned int npools = svc_pool_map_get();
441 443
442 serv = __svc_create(prog, bufsize, npools, shutdown); 444 serv = __svc_create(prog, bufsize, npools, family, shutdown);
443 445
444 if (serv != NULL) { 446 if (serv != NULL) {
445 serv->sv_function = func; 447 serv->sv_function = func;
@@ -486,8 +488,7 @@ svc_destroy(struct svc_serv *serv)
486 if (svc_serv_is_pooled(serv)) 488 if (svc_serv_is_pooled(serv))
487 svc_pool_map_put(); 489 svc_pool_map_put();
488 490
489 /* Unregister service with the portmapper */ 491 svc_unregister(serv);
490 svc_register(serv, 0, 0);
491 kfree(serv->sv_pools); 492 kfree(serv->sv_pools);
492 kfree(serv); 493 kfree(serv);
493} 494}
@@ -718,55 +719,245 @@ svc_exit_thread(struct svc_rqst *rqstp)
718} 719}
719EXPORT_SYMBOL(svc_exit_thread); 720EXPORT_SYMBOL(svc_exit_thread);
720 721
722#ifdef CONFIG_SUNRPC_REGISTER_V4
723
721/* 724/*
722 * Register an RPC service with the local portmapper. 725 * Register an "inet" protocol family netid with the local
723 * To unregister a service, call this routine with 726 * rpcbind daemon via an rpcbind v4 SET request.
724 * proto and port == 0. 727 *
728 * No netconfig infrastructure is available in the kernel, so
729 * we map IP_ protocol numbers to netids by hand.
730 *
731 * Returns zero on success; a negative errno value is returned
732 * if any error occurs.
725 */ 733 */
726int 734static int __svc_rpcb_register4(const u32 program, const u32 version,
727svc_register(struct svc_serv *serv, int proto, unsigned short port) 735 const unsigned short protocol,
736 const unsigned short port)
737{
738 struct sockaddr_in sin = {
739 .sin_family = AF_INET,
740 .sin_addr.s_addr = htonl(INADDR_ANY),
741 .sin_port = htons(port),
742 };
743 char *netid;
744
745 switch (protocol) {
746 case IPPROTO_UDP:
747 netid = RPCBIND_NETID_UDP;
748 break;
749 case IPPROTO_TCP:
750 netid = RPCBIND_NETID_TCP;
751 break;
752 default:
753 return -EPROTONOSUPPORT;
754 }
755
756 return rpcb_v4_register(program, version,
757 (struct sockaddr *)&sin, netid);
758}
759
760/*
761 * Register an "inet6" protocol family netid with the local
762 * rpcbind daemon via an rpcbind v4 SET request.
763 *
764 * No netconfig infrastructure is available in the kernel, so
765 * we map IP_ protocol numbers to netids by hand.
766 *
767 * Returns zero on success; a negative errno value is returned
768 * if any error occurs.
769 */
770static int __svc_rpcb_register6(const u32 program, const u32 version,
771 const unsigned short protocol,
772 const unsigned short port)
773{
774 struct sockaddr_in6 sin6 = {
775 .sin6_family = AF_INET6,
776 .sin6_addr = IN6ADDR_ANY_INIT,
777 .sin6_port = htons(port),
778 };
779 char *netid;
780
781 switch (protocol) {
782 case IPPROTO_UDP:
783 netid = RPCBIND_NETID_UDP6;
784 break;
785 case IPPROTO_TCP:
786 netid = RPCBIND_NETID_TCP6;
787 break;
788 default:
789 return -EPROTONOSUPPORT;
790 }
791
792 return rpcb_v4_register(program, version,
793 (struct sockaddr *)&sin6, netid);
794}
795
796/*
797 * Register a kernel RPC service via rpcbind version 4.
798 *
799 * Returns zero on success; a negative errno value is returned
800 * if any error occurs.
801 */
802static int __svc_register(const u32 program, const u32 version,
803 const sa_family_t family,
804 const unsigned short protocol,
805 const unsigned short port)
806{
807 int error;
808
809 switch (family) {
810 case AF_INET:
811 return __svc_rpcb_register4(program, version,
812 protocol, port);
813 case AF_INET6:
814 error = __svc_rpcb_register6(program, version,
815 protocol, port);
816 if (error < 0)
817 return error;
818
819 /*
820 * Work around bug in some versions of Linux rpcbind
821 * which don't allow registration of both inet and
822 * inet6 netids.
823 *
824 * Error return ignored for now.
825 */
826 __svc_rpcb_register4(program, version,
827 protocol, port);
828 return 0;
829 }
830
831 return -EAFNOSUPPORT;
832}
833
834#else /* CONFIG_SUNRPC_REGISTER_V4 */
835
836/*
837 * Register a kernel RPC service via rpcbind version 2.
838 *
839 * Returns zero on success; a negative errno value is returned
840 * if any error occurs.
841 */
842static int __svc_register(const u32 program, const u32 version,
843 sa_family_t family,
844 const unsigned short protocol,
845 const unsigned short port)
846{
847 if (family != AF_INET)
848 return -EAFNOSUPPORT;
849
850 return rpcb_register(program, version, protocol, port);
851}
852
853#endif /* CONFIG_SUNRPC_REGISTER_V4 */
854
855/**
856 * svc_register - register an RPC service with the local portmapper
857 * @serv: svc_serv struct for the service to register
858 * @proto: transport protocol number to advertise
859 * @port: port to advertise
860 *
861 * Service is registered for any address in serv's address family
862 */
863int svc_register(const struct svc_serv *serv, const unsigned short proto,
864 const unsigned short port)
728{ 865{
729 struct svc_program *progp; 866 struct svc_program *progp;
730 unsigned long flags;
731 unsigned int i; 867 unsigned int i;
732 int error = 0, dummy; 868 int error = 0;
733 869
734 if (!port) 870 BUG_ON(proto == 0 && port == 0);
735 clear_thread_flag(TIF_SIGPENDING);
736 871
737 for (progp = serv->sv_program; progp; progp = progp->pg_next) { 872 for (progp = serv->sv_program; progp; progp = progp->pg_next) {
738 for (i = 0; i < progp->pg_nvers; i++) { 873 for (i = 0; i < progp->pg_nvers; i++) {
739 if (progp->pg_vers[i] == NULL) 874 if (progp->pg_vers[i] == NULL)
740 continue; 875 continue;
741 876
742 dprintk("svc: svc_register(%s, %s, %d, %d)%s\n", 877 dprintk("svc: svc_register(%sv%d, %s, %u, %u)%s\n",
743 progp->pg_name, 878 progp->pg_name,
879 i,
744 proto == IPPROTO_UDP? "udp" : "tcp", 880 proto == IPPROTO_UDP? "udp" : "tcp",
745 port, 881 port,
746 i, 882 serv->sv_family,
747 progp->pg_vers[i]->vs_hidden? 883 progp->pg_vers[i]->vs_hidden?
748 " (but not telling portmap)" : ""); 884 " (but not telling portmap)" : "");
749 885
750 if (progp->pg_vers[i]->vs_hidden) 886 if (progp->pg_vers[i]->vs_hidden)
751 continue; 887 continue;
752 888
753 error = rpcb_register(progp->pg_prog, i, proto, port, &dummy); 889 error = __svc_register(progp->pg_prog, i,
890 serv->sv_family, proto, port);
754 if (error < 0) 891 if (error < 0)
755 break; 892 break;
756 if (port && !dummy) {
757 error = -EACCES;
758 break;
759 }
760 } 893 }
761 } 894 }
762 895
763 if (!port) { 896 return error;
764 spin_lock_irqsave(&current->sighand->siglock, flags); 897}
765 recalc_sigpending(); 898
766 spin_unlock_irqrestore(&current->sighand->siglock, flags); 899#ifdef CONFIG_SUNRPC_REGISTER_V4
900
901static void __svc_unregister(const u32 program, const u32 version,
902 const char *progname)
903{
904 struct sockaddr_in6 sin6 = {
905 .sin6_family = AF_INET6,
906 .sin6_addr = IN6ADDR_ANY_INIT,
907 .sin6_port = 0,
908 };
909 int error;
910
911 error = rpcb_v4_register(program, version,
912 (struct sockaddr *)&sin6, "");
913 dprintk("svc: %s(%sv%u), error %d\n",
914 __func__, progname, version, error);
915}
916
917#else /* CONFIG_SUNRPC_REGISTER_V4 */
918
919static void __svc_unregister(const u32 program, const u32 version,
920 const char *progname)
921{
922 int error;
923
924 error = rpcb_register(program, version, 0, 0);
925 dprintk("svc: %s(%sv%u), error %d\n",
926 __func__, progname, version, error);
927}
928
929#endif /* CONFIG_SUNRPC_REGISTER_V4 */
930
931/*
932 * All netids, bind addresses and ports registered for [program, version]
933 * are removed from the local rpcbind database (if the service is not
934 * hidden) to make way for a new instance of the service.
935 *
936 * The result of unregistration is reported via dprintk for those who want
937 * verification of the result, but is otherwise not important.
938 */
939static void svc_unregister(const struct svc_serv *serv)
940{
941 struct svc_program *progp;
942 unsigned long flags;
943 unsigned int i;
944
945 clear_thread_flag(TIF_SIGPENDING);
946
947 for (progp = serv->sv_program; progp; progp = progp->pg_next) {
948 for (i = 0; i < progp->pg_nvers; i++) {
949 if (progp->pg_vers[i] == NULL)
950 continue;
951 if (progp->pg_vers[i]->vs_hidden)
952 continue;
953
954 __svc_unregister(progp->pg_prog, i, progp->pg_name);
955 }
767 } 956 }
768 957
769 return error; 958 spin_lock_irqsave(&current->sighand->siglock, flags);
959 recalc_sigpending();
960 spin_unlock_irqrestore(&current->sighand->siglock, flags);
770} 961}
771 962
772/* 963/*
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index e46c825f4954..bf5b5cdafebf 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -159,15 +159,44 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt,
159} 159}
160EXPORT_SYMBOL_GPL(svc_xprt_init); 160EXPORT_SYMBOL_GPL(svc_xprt_init);
161 161
162int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, 162static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
163 int flags) 163 struct svc_serv *serv,
164 unsigned short port, int flags)
164{ 165{
165 struct svc_xprt_class *xcl;
166 struct sockaddr_in sin = { 166 struct sockaddr_in sin = {
167 .sin_family = AF_INET, 167 .sin_family = AF_INET,
168 .sin_addr.s_addr = htonl(INADDR_ANY), 168 .sin_addr.s_addr = htonl(INADDR_ANY),
169 .sin_port = htons(port), 169 .sin_port = htons(port),
170 }; 170 };
171 struct sockaddr_in6 sin6 = {
172 .sin6_family = AF_INET6,
173 .sin6_addr = IN6ADDR_ANY_INIT,
174 .sin6_port = htons(port),
175 };
176 struct sockaddr *sap;
177 size_t len;
178
179 switch (serv->sv_family) {
180 case AF_INET:
181 sap = (struct sockaddr *)&sin;
182 len = sizeof(sin);
183 break;
184 case AF_INET6:
185 sap = (struct sockaddr *)&sin6;
186 len = sizeof(sin6);
187 break;
188 default:
189 return ERR_PTR(-EAFNOSUPPORT);
190 }
191
192 return xcl->xcl_ops->xpo_create(serv, sap, len, flags);
193}
194
195int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
196 int flags)
197{
198 struct svc_xprt_class *xcl;
199
171 dprintk("svc: creating transport %s[%d]\n", xprt_name, port); 200 dprintk("svc: creating transport %s[%d]\n", xprt_name, port);
172 spin_lock(&svc_xprt_class_lock); 201 spin_lock(&svc_xprt_class_lock);
173 list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { 202 list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) {
@@ -180,9 +209,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
180 goto err; 209 goto err;
181 210
182 spin_unlock(&svc_xprt_class_lock); 211 spin_unlock(&svc_xprt_class_lock);
183 newxprt = xcl->xcl_ops-> 212 newxprt = __svc_xpo_create(xcl, serv, port, flags);
184 xpo_create(serv, (struct sockaddr *)&sin, sizeof(sin),
185 flags);
186 if (IS_ERR(newxprt)) { 213 if (IS_ERR(newxprt)) {
187 module_put(xcl->xcl_owner); 214 module_put(xcl->xcl_owner);
188 return PTR_ERR(newxprt); 215 return PTR_ERR(newxprt);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 3e65719f1ef6..95293f549e9c 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1114,6 +1114,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1114 struct svc_sock *svsk; 1114 struct svc_sock *svsk;
1115 struct sock *inet; 1115 struct sock *inet;
1116 int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); 1116 int pmap_register = !(flags & SVC_SOCK_ANONYMOUS);
1117 int val;
1117 1118
1118 dprintk("svc: svc_setup_socket %p\n", sock); 1119 dprintk("svc: svc_setup_socket %p\n", sock);
1119 if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { 1120 if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) {
@@ -1146,6 +1147,18 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1146 else 1147 else
1147 svc_tcp_init(svsk, serv); 1148 svc_tcp_init(svsk, serv);
1148 1149
1150 /*
1151 * We start one listener per sv_serv. We want AF_INET
1152 * requests to be automatically shunted to our AF_INET6
1153 * listener using a mapped IPv4 address. Make sure
1154 * no-one starts an equivalent IPv4 listener, which
1155 * would steal our incoming connections.
1156 */
1157 val = 0;
1158 if (serv->sv_family == AF_INET6)
1159 kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY,
1160 (char *)&val, sizeof(val));
1161
1149 dprintk("svc: svc_setup_socket created %p (inet %p)\n", 1162 dprintk("svc: svc_setup_socket created %p (inet %p)\n",
1150 svsk, svsk->sk_sk); 1163 svsk, svsk->sk_sk);
1151 1164
@@ -1154,8 +1167,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
1154 1167
1155int svc_addsock(struct svc_serv *serv, 1168int svc_addsock(struct svc_serv *serv,
1156 int fd, 1169 int fd,
1157 char *name_return, 1170 char *name_return)
1158 int *proto)
1159{ 1171{
1160 int err = 0; 1172 int err = 0;
1161 struct socket *so = sockfd_lookup(fd, &err); 1173 struct socket *so = sockfd_lookup(fd, &err);
@@ -1190,7 +1202,6 @@ int svc_addsock(struct svc_serv *serv,
1190 sockfd_put(so); 1202 sockfd_put(so);
1191 return err; 1203 return err;
1192 } 1204 }
1193 if (proto) *proto = so->sk->sk_protocol;
1194 return one_sock_name(name_return, svsk); 1205 return one_sock_name(name_return, svsk);
1195} 1206}
1196EXPORT_SYMBOL_GPL(svc_addsock); 1207EXPORT_SYMBOL_GPL(svc_addsock);