aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cpu-hotplug.txt148
-rw-r--r--Documentation/memory-barriers.txt2
-rw-r--r--arch/arm/mach-lh7a40x/common.h2
-rw-r--r--arch/i386/kernel/alternative.c4
-rw-r--r--arch/i386/lib/usercopy.c3
-rw-r--r--arch/sparc64/kernel/of_device.c7
-rw-r--r--arch/sparc64/kernel/pci_sabre.c2
-rw-r--r--arch/um/Kconfig6
-rw-r--r--arch/um/Kconfig.char5
-rw-r--r--arch/um/drivers/cow_sys.h1
-rw-r--r--arch/um/drivers/daemon_user.c1
-rw-r--r--arch/um/drivers/fd.c1
-rw-r--r--arch/um/drivers/mcast_user.c1
-rw-r--r--arch/um/drivers/mmapper_kern.c3
-rw-r--r--arch/um/drivers/net_user.c1
-rw-r--r--arch/um/drivers/pcap_user.c1
-rw-r--r--arch/um/drivers/port_user.c1
-rw-r--r--arch/um/drivers/pty.c1
-rw-r--r--arch/um/drivers/slip_user.c1
-rw-r--r--arch/um/drivers/tty.c1
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/um_malloc.h17
-rw-r--r--arch/um/include/user.h6
-rw-r--r--arch/um/include/user_util.h1
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/kernel/process.c1
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c1
-rw-r--r--arch/um/os-Linux/helper.c54
-rw-r--r--arch/um/os-Linux/irq.c1
-rw-r--r--arch/um/os-Linux/main.c1
-rw-r--r--arch/um/os-Linux/sigio.c1
-rw-r--r--arch/um/os-Linux/time.c3
-rw-r--r--block/ll_rw_blk.c83
-rw-r--r--drivers/acpi/acpi_memhotplug.c14
-rw-r--r--drivers/acpi/processor_idle.c2
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/bluetooth/hci_usb.c3
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/firmware/dcdbas.c7
-rw-r--r--drivers/isdn/hisax/diva.c26
-rw-r--r--drivers/isdn/hysdn/boardergo.c2
-rw-r--r--drivers/md/dm-crypt.c3
-rw-r--r--drivers/net/e100.c50
-rw-r--r--drivers/net/loopback.c39
-rw-r--r--drivers/net/tg3.c19
-rw-r--r--drivers/scsi/eata_pio.c2
-rw-r--r--drivers/serial/Kconfig12
-rw-r--r--fs/Kconfig8
-rw-r--r--fs/autofs/autofs_i.h1
-rw-r--r--fs/autofs/dirhash.c1
-rw-r--r--fs/autofs/init.c2
-rw-r--r--fs/autofs/inode.c4
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/fat/file.c3
-rw-r--r--fs/jbd/transaction.c5
-rw-r--r--fs/jbd2/transaction.c5
-rw-r--r--fs/lockd/clntlock.c4
-rw-r--r--fs/lockd/mon.c12
-rw-r--r--fs/lockd/svc4proc.c44
-rw-r--r--fs/lockd/svclock.c10
-rw-r--r--fs/lockd/svcproc.c48
-rw-r--r--fs/lockd/svcshare.c4
-rw-r--r--fs/lockd/svcsubs.c4
-rw-r--r--fs/lockd/xdr.c76
-rw-r--r--fs/lockd/xdr4.c80
-rw-r--r--fs/nfs/callback.h10
-rw-r--r--fs/nfs/callback_proc.c6
-rw-r--r--fs/nfs/callback_xdr.c106
-rw-r--r--fs/nfs/client.c27
-rw-r--r--fs/nfs/dir.c16
-rw-r--r--fs/nfs/direct.c25
-rw-r--r--fs/nfs/inode.c30
-rw-r--r--fs/nfs/internal.h6
-rw-r--r--fs/nfs/mount_clnt.c6
-rw-r--r--fs/nfs/nfs2xdr.c78
-rw-r--r--fs/nfs/nfs3proc.c2
-rw-r--r--fs/nfs/nfs3xdr.c118
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c16
-rw-r--r--fs/nfs/nfs4xdr.c360
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/nfs/write.c8
-rw-r--r--fs/nfs_common/nfsacl.c4
-rw-r--r--fs/nfsd/export.c4
-rw-r--r--fs/nfsd/lockd.c2
-rw-r--r--fs/nfsd/nfs2acl.c34
-rw-r--r--fs/nfsd/nfs3acl.c20
-rw-r--r--fs/nfsd/nfs3proc.c90
-rw-r--r--fs/nfsd/nfs3xdr.c126
-rw-r--r--fs/nfsd/nfs4callback.c22
-rw-r--r--fs/nfsd/nfs4proc.c94
-rw-r--r--fs/nfsd/nfs4recover.c14
-rw-r--r--fs/nfsd/nfs4state.c119
-rw-r--r--fs/nfsd/nfs4xdr.c273
-rw-r--r--fs/nfsd/nfscache.c8
-rw-r--r--fs/nfsd/nfsfh.c10
-rw-r--r--fs/nfsd/nfsproc.c79
-rw-r--r--fs/nfsd/nfssvc.c10
-rw-r--r--fs/nfsd/nfsxdr.c72
-rw-r--r--fs/nfsd/vfs.c299
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/reiserfs/journal.c3
-rw-r--r--fs/xfs/linux-2.6/kmem.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c3
-rw-r--r--include/asm-generic/bug.h5
-rw-r--r--include/asm-sparc/elf.h41
-rw-r--r--include/asm-um/archparam-ppc.h9
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/backing-dev.h7
-rw-r--r--include/linux/blkdev.h22
-rw-r--r--include/linux/irq.h3
-rw-r--r--include/linux/lockd/lockd.h12
-rw-r--r--include/linux/lockd/share.h4
-rw-r--r--include/linux/lockd/xdr.h26
-rw-r--r--include/linux/lockd/xdr4.h26
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/nfs_fs.h3
-rw-r--r--include/linux/nfs_xdr.h10
-rw-r--r--include/linux/nfsd/cache.h6
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/nfsd/nfsd.h43
-rw-r--r--include/linux/nfsd/nfsfh.h8
-rw-r--r--include/linux/nfsd/state.h12
-rw-r--r--include/linux/nfsd/xdr.h50
-rw-r--r--include/linux/nfsd/xdr3.h114
-rw-r--r--include/linux/nfsd/xdr4.h54
-rw-r--r--include/linux/oom.h10
-rw-r--r--include/linux/personality.h7
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/tipc.h1
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/net/inetpeer.h7
-rw-r--r--include/net/ip6_route.h7
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/nsproxy.c6
-rw-r--r--kernel/sched.c18
-rw-r--r--kernel/sysctl.c4
-rw-r--r--lib/cpumask.c16
-rw-r--r--mm/Makefile3
-rw-r--r--mm/backing-dev.c69
-rw-r--r--mm/filemap.c55
-rw-r--r--mm/memory.c1
-rw-r--r--mm/oom_kill.c1
-rw-r--r--mm/page-writeback.c17
-rw-r--r--mm/page_alloc.c21
-rw-r--r--mm/rmap.c36
-rw-r--r--mm/shmem.c3
-rw-r--r--mm/vmscan.c6
-rw-r--r--net/bluetooth/hidp/core.c6
-rw-r--r--net/core/netpoll.c8
-rw-r--r--net/decnet/dn_route.c3
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/netfilter/ip_tables.c3
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_output.c20
-rw-r--r--net/ipv6/Kconfig16
-rw-r--r--net/ipv6/route.c47
-rw-r--r--net/ipv6/xfrm6_policy.c12
-rw-r--r--net/sctp/ipv6.c10
-rw-r--r--net/sctp/socket.c2
-rw-r--r--net/sunrpc/pmap_clnt.c14
-rw-r--r--net/sunrpc/svcsock.c2
-rw-r--r--net/sunrpc/xprtsock.c2
-rw-r--r--net/tipc/bearer.c8
-rw-r--r--net/tipc/config.c5
-rw-r--r--net/tipc/core.c4
-rw-r--r--net/tipc/core.h30
-rw-r--r--net/tipc/dbg.c136
-rw-r--r--net/tipc/dbg.h15
-rw-r--r--net/tipc/discover.c39
-rw-r--r--net/tipc/link.c8
-rw-r--r--net/tipc/name_distr.c2
-rw-r--r--net/tipc/node.c2
-rw-r--r--net/tipc/port.c7
-rw-r--r--net/tipc/socket.c13
-rw-r--r--net/tipc/subscr.c99
178 files changed, 2346 insertions, 1913 deletions
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index bc107cb157a8..4868c34f7509 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -46,7 +46,7 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
46 maxcpus=2 will only boot 2. You can choose to bring the 46 maxcpus=2 will only boot 2. You can choose to bring the
47 other cpus later online, read FAQ's for more info. 47 other cpus later online, read FAQ's for more info.
48 48
49additional_cpus*=n Use this to limit hotpluggable cpus. This option sets 49additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
50 cpu_possible_map = cpu_present_map + additional_cpus 50 cpu_possible_map = cpu_present_map + additional_cpus
51 51
52(*) Option valid only for following architectures 52(*) Option valid only for following architectures
@@ -101,15 +101,15 @@ cpu_possible_map/for_each_possible_cpu() to iterate.
101 101
102Never use anything other than cpumask_t to represent bitmap of CPUs. 102Never use anything other than cpumask_t to represent bitmap of CPUs.
103 103
104#include <linux/cpumask.h> 104 #include <linux/cpumask.h>
105 105
106for_each_possible_cpu - Iterate over cpu_possible_map 106 for_each_possible_cpu - Iterate over cpu_possible_map
107for_each_online_cpu - Iterate over cpu_online_map 107 for_each_online_cpu - Iterate over cpu_online_map
108for_each_present_cpu - Iterate over cpu_present_map 108 for_each_present_cpu - Iterate over cpu_present_map
109for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. 109 for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.
110 110
111#include <linux/cpu.h> 111 #include <linux/cpu.h>
112lock_cpu_hotplug() and unlock_cpu_hotplug(): 112 lock_cpu_hotplug() and unlock_cpu_hotplug():
113 113
114The above calls are used to inhibit cpu hotplug operations. While holding the 114The above calls are used to inhibit cpu hotplug operations. While holding the
115cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid 115cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid
@@ -120,7 +120,7 @@ will work as long as stop_machine_run() is used to take a cpu down.
120 120
121CPU Hotplug - Frequently Asked Questions. 121CPU Hotplug - Frequently Asked Questions.
122 122
123Q: How to i enable my kernel to support CPU hotplug? 123Q: How to enable my kernel to support CPU hotplug?
124A: When doing make defconfig, Enable CPU hotplug support 124A: When doing make defconfig, Enable CPU hotplug support
125 125
126 "Processor type and Features" -> Support for Hotpluggable CPUs 126 "Processor type and Features" -> Support for Hotpluggable CPUs
@@ -141,39 +141,39 @@ A: You should now notice an entry in sysfs.
141Check if sysfs is mounted, using the "mount" command. You should notice 141Check if sysfs is mounted, using the "mount" command. You should notice
142an entry as shown below in the output. 142an entry as shown below in the output.
143 143
144.... 144 ....
145none on /sys type sysfs (rw) 145 none on /sys type sysfs (rw)
146.... 146 ....
147 147
148if this is not mounted, do the following. 148If this is not mounted, do the following.
149 149
150#mkdir /sysfs 150 #mkdir /sysfs
151#mount -t sysfs sys /sys 151 #mount -t sysfs sys /sys
152 152
153now you should see entries for all present cpu, the following is an example 153Now you should see entries for all present cpu, the following is an example
154in a 8-way system. 154in a 8-way system.
155 155
156#pwd 156 #pwd
157#/sys/devices/system/cpu 157 #/sys/devices/system/cpu
158#ls -l 158 #ls -l
159total 0 159 total 0
160drwxr-xr-x 10 root root 0 Sep 19 07:44 . 160 drwxr-xr-x 10 root root 0 Sep 19 07:44 .
161drwxr-xr-x 13 root root 0 Sep 19 07:45 .. 161 drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
162drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0 162 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
163drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1 163 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
164drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2 164 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
165drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3 165 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
166drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4 166 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
167drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5 167 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
168drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6 168 drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
169drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7 169 drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7
170 170
171Under each directory you would find an "online" file which is the control 171Under each directory you would find an "online" file which is the control
172file to logically online/offline a processor. 172file to logically online/offline a processor.
173 173
174Q: Does hot-add/hot-remove refer to physical add/remove of cpus? 174Q: Does hot-add/hot-remove refer to physical add/remove of cpus?
175A: The usage of hot-add/remove may not be very consistently used in the code. 175A: The usage of hot-add/remove may not be very consistently used in the code.
176CONFIG_CPU_HOTPLUG enables logical online/offline capability in the kernel. 176CONFIG_HOTPLUG_CPU enables logical online/offline capability in the kernel.
177To support physical addition/removal, one would need some BIOS hooks and 177To support physical addition/removal, one would need some BIOS hooks and
178the platform should have something like an attention button in PCI hotplug. 178the platform should have something like an attention button in PCI hotplug.
179CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs. 179CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
@@ -181,17 +181,17 @@ CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
181Q: How do i logically offline a CPU? 181Q: How do i logically offline a CPU?
182A: Do the following. 182A: Do the following.
183 183
184#echo 0 > /sys/devices/system/cpu/cpuX/online 184 #echo 0 > /sys/devices/system/cpu/cpuX/online
185 185
186once the logical offline is successful, check 186Once the logical offline is successful, check
187 187
188#cat /proc/interrupts 188 #cat /proc/interrupts
189 189
190you should now not see the CPU that you removed. Also online file will report 190You should now not see the CPU that you removed. Also online file will report
191the state as 0 when a cpu if offline and 1 when its online. 191the state as 0 when a cpu if offline and 1 when its online.
192 192
193#To display the current cpu state. 193 #To display the current cpu state.
194#cat /sys/devices/system/cpu/cpuX/online 194 #cat /sys/devices/system/cpu/cpuX/online
195 195
196Q: Why cant i remove CPU0 on some systems? 196Q: Why cant i remove CPU0 on some systems?
197A: Some architectures may have some special dependency on a certain CPU. 197A: Some architectures may have some special dependency on a certain CPU.
@@ -234,8 +234,8 @@ Q: If i have some kernel code that needs to be aware of CPU arrival and
234 departure, how to i arrange for proper notification? 234 departure, how to i arrange for proper notification?
235A: This is what you would need in your kernel code to receive notifications. 235A: This is what you would need in your kernel code to receive notifications.
236 236
237 #include <linux/cpu.h> 237 #include <linux/cpu.h>
238 static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb, 238 static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
239 unsigned long action, void *hcpu) 239 unsigned long action, void *hcpu)
240 { 240 {
241 unsigned int cpu = (unsigned long)hcpu; 241 unsigned int cpu = (unsigned long)hcpu;
@@ -279,10 +279,10 @@ Q: I don't see my action being called for all CPUs already up and running?
279A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined. 279A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined.
280 If you need to perform some action for each cpu already in the system, then 280 If you need to perform some action for each cpu already in the system, then
281 281
282 for_each_online_cpu(i) { 282 for_each_online_cpu(i) {
283 foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i); 283 foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i);
284 foobar_cpu_callback(&foobar-cpu_notifier, CPU_ONLINE, i); 284 foobar_cpu_callback(&foobar_cpu_notifier, CPU_ONLINE, i);
285 } 285 }
286 286
287Q: If i would like to develop cpu hotplug support for a new architecture, 287Q: If i would like to develop cpu hotplug support for a new architecture,
288 what do i need at a minimum? 288 what do i need at a minimum?
@@ -307,38 +307,38 @@ Q: I need to ensure that a particular cpu is not removed when there is some
307 work specific to this cpu is in progress. 307 work specific to this cpu is in progress.
308A: First switch the current thread context to preferred cpu 308A: First switch the current thread context to preferred cpu
309 309
310 int my_func_on_cpu(int cpu) 310 int my_func_on_cpu(int cpu)
311 { 311 {
312 cpumask_t saved_mask, new_mask = CPU_MASK_NONE; 312 cpumask_t saved_mask, new_mask = CPU_MASK_NONE;
313 int curr_cpu, err = 0; 313 int curr_cpu, err = 0;
314 314
315 saved_mask = current->cpus_allowed; 315 saved_mask = current->cpus_allowed;
316 cpu_set(cpu, new_mask); 316 cpu_set(cpu, new_mask);
317 err = set_cpus_allowed(current, new_mask); 317 err = set_cpus_allowed(current, new_mask);
318 318
319 if (err) 319 if (err)
320 return err; 320 return err;
321 321
322 /* 322 /*
323 * If we got scheduled out just after the return from 323 * If we got scheduled out just after the return from
324 * set_cpus_allowed() before running the work, this ensures 324 * set_cpus_allowed() before running the work, this ensures
325 * we stay locked. 325 * we stay locked.
326 */ 326 */
327 curr_cpu = get_cpu(); 327 curr_cpu = get_cpu();
328 328
329 if (curr_cpu != cpu) { 329 if (curr_cpu != cpu) {
330 err = -EAGAIN; 330 err = -EAGAIN;
331 goto ret; 331 goto ret;
332 } else { 332 } else {
333 /* 333 /*
334 * Do work : But cant sleep, since get_cpu() disables preempt 334 * Do work : But cant sleep, since get_cpu() disables preempt
335 */ 335 */
336 } 336 }
337 ret: 337 ret:
338 put_cpu(); 338 put_cpu();
339 set_cpus_allowed(current, saved_mask); 339 set_cpus_allowed(current, saved_mask);
340 return err; 340 return err;
341 } 341 }
342 342
343 343
344Q: How do we determine how many CPUs are available for hotplug. 344Q: How do we determine how many CPUs are available for hotplug.
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 994355b0cd19..7f790f66ec68 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1898,7 +1898,7 @@ queue before processing any further requests:
1898 smp_wmb(); 1898 smp_wmb();
1899 <A:modify v=2> <C:busy> 1899 <A:modify v=2> <C:busy>
1900 <C:queue v=2> 1900 <C:queue v=2>
1901 p = &b; q = p; 1901 p = &v; q = p;
1902 <D:request p> 1902 <D:request p>
1903 <B:modify p=&v> <D:commit p=&v> 1903 <B:modify p=&v> <D:commit p=&v>
1904 <D:read p> 1904 <D:read p>
diff --git a/arch/arm/mach-lh7a40x/common.h b/arch/arm/mach-lh7a40x/common.h
index 18e8bb4eb202..0ca20c6c83b7 100644
--- a/arch/arm/mach-lh7a40x/common.h
+++ b/arch/arm/mach-lh7a40x/common.h
@@ -15,4 +15,4 @@ extern void lh7a404_init_irq (void);
15extern void lh7a40x_clcd_init (void); 15extern void lh7a40x_clcd_init (void);
16extern void lh7a40x_init_board_irq (void); 16extern void lh7a40x_init_board_irq (void);
17 17
18#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq), regs) 18#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq))
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 28ab80649764..583c238e17fb 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -344,6 +344,7 @@ void alternatives_smp_switch(int smp)
344 344
345void __init alternative_instructions(void) 345void __init alternative_instructions(void)
346{ 346{
347 unsigned long flags;
347 if (no_replacement) { 348 if (no_replacement) {
348 printk(KERN_INFO "(SMP-)alternatives turned off\n"); 349 printk(KERN_INFO "(SMP-)alternatives turned off\n");
349 free_init_pages("SMP alternatives", 350 free_init_pages("SMP alternatives",
@@ -351,6 +352,8 @@ void __init alternative_instructions(void)
351 (unsigned long)__smp_alt_end); 352 (unsigned long)__smp_alt_end);
352 return; 353 return;
353 } 354 }
355
356 local_irq_save(flags);
354 apply_alternatives(__alt_instructions, __alt_instructions_end); 357 apply_alternatives(__alt_instructions, __alt_instructions_end);
355 358
356 /* switch to patch-once-at-boottime-only mode and free the 359 /* switch to patch-once-at-boottime-only mode and free the
@@ -386,4 +389,5 @@ void __init alternative_instructions(void)
386 alternatives_smp_switch(0); 389 alternatives_smp_switch(0);
387 } 390 }
388#endif 391#endif
392 local_irq_restore(flags);
389} 393}
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index 258df6b4d7d7..d22cfc9d656c 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -9,6 +9,7 @@
9#include <linux/highmem.h> 9#include <linux/highmem.h>
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/backing-dev.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13#include <asm/mmx.h> 14#include <asm/mmx.h>
14 15
@@ -741,7 +742,7 @@ survive:
741 742
742 if (retval == -ENOMEM && is_init(current)) { 743 if (retval == -ENOMEM && is_init(current)) {
743 up_read(&current->mm->mmap_sem); 744 up_read(&current->mm->mmap_sem);
744 blk_congestion_wait(WRITE, HZ/50); 745 congestion_wait(WRITE, HZ/50);
745 goto survive; 746 goto survive;
746 } 747 }
747 748
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index d822c7c18e1f..d3dfb2a36d47 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -131,8 +131,13 @@ static int of_device_resume(struct device * dev)
131void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name) 131void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name)
132{ 132{
133 unsigned long ret = res->start + offset; 133 unsigned long ret = res->start + offset;
134 struct resource *r;
134 135
135 if (!request_region(ret, size, name)) 136 if (res->flags & IORESOURCE_MEM)
137 r = request_mem_region(ret, size, name);
138 else
139 r = request_region(ret, size, name);
140 if (!r)
136 ret = 0; 141 ret = 0;
137 142
138 return (void __iomem *) ret; 143 return (void __iomem *) ret;
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index de7f7850a844..94bb681f2323 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -1465,5 +1465,5 @@ void sabre_init(struct device_node *dp, char *model_name)
1465 /* 1465 /*
1466 * Look for APB underneath. 1466 * Look for APB underneath.
1467 */ 1467 */
1468 sabre_pbm_init(p, dp, vdma[0], vdma[1]); 1468 sabre_pbm_init(p, dp, vdma[0], vdma[0] + vdma[1]);
1469} 1469}
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 78fb619bdb73..5ac1f2963ae3 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -1,3 +1,8 @@
1config DEFCONFIG_LIST
2 string
3 option defconfig_list
4 default "arch/$ARCH/defconfig"
5
1# UML uses the generic IRQ sugsystem 6# UML uses the generic IRQ sugsystem
2config GENERIC_HARDIRQS 7config GENERIC_HARDIRQS
3 bool 8 bool
@@ -52,6 +57,7 @@ menu "UML-specific options"
52config MODE_TT 57config MODE_TT
53 bool "Tracing thread support (DEPRECATED)" 58 bool "Tracing thread support (DEPRECATED)"
54 default n 59 default n
60 depends on BROKEN
55 help 61 help
56 This option controls whether tracing thread support is compiled 62 This option controls whether tracing thread support is compiled
57 into UML. This option is largely obsolete, given that skas0 provides 63 into UML. This option is largely obsolete, given that skas0 provides
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 62d87b71179b..e03e40c7aac3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -190,6 +190,11 @@ config HOSTAUDIO
190 tristate 190 tristate
191 default UML_SOUND 191 default UML_SOUND
192 192
193#It is selected elsewhere, so kconfig would warn without this.
194config HW_RANDOM
195 tristate
196 default n
197
193config UML_RANDOM 198config UML_RANDOM
194 tristate "Hardware random number generator" 199 tristate "Hardware random number generator"
195 help 200 help
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index 7a5b4afde692..c6a308464acb 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -5,6 +5,7 @@
5#include "user_util.h" 5#include "user_util.h"
6#include "os.h" 6#include "os.h"
7#include "user.h" 7#include "user.h"
8#include "um_malloc.h"
8 9
9static inline void *cow_malloc(int size) 10static inline void *cow_malloc(int size)
10{ 11{
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 77954ea77043..310af0f1e49e 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -17,6 +17,7 @@
17#include "user_util.h" 17#include "user_util.h"
18#include "user.h" 18#include "user.h"
19#include "os.h" 19#include "os.h"
20#include "um_malloc.h"
20 21
21#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 22#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
22 23
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 108b7dafbd0e..218aa0e9b792 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -12,6 +12,7 @@
12#include "user_util.h" 12#include "user_util.h"
13#include "chan_user.h" 13#include "chan_user.h"
14#include "os.h" 14#include "os.h"
15#include "um_malloc.h"
15 16
16struct fd_chan { 17struct fd_chan {
17 int fd; 18 int fd;
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 4d2bd39a85bc..8138f5ea1bf7 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -23,6 +23,7 @@
23#include "user_util.h" 23#include "user_util.h"
24#include "user.h" 24#include "user.h"
25#include "os.h" 25#include "os.h"
26#include "um_malloc.h"
26 27
27#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 28#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
28 29
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index 9a3b5daf6250..df3516e47d4d 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -95,7 +95,8 @@ static const struct file_operations mmapper_fops = {
95 .release = mmapper_release, 95 .release = mmapper_release,
96}; 96};
97 97
98static const struct miscdevice mmapper_dev = { 98/* No locking needed - only used (and modified) by below initcall and exitcall. */
99static struct miscdevice mmapper_dev = {
99 .minor = MISC_DYNAMIC_MINOR, 100 .minor = MISC_DYNAMIC_MINOR,
100 .name = "mmapper", 101 .name = "mmapper",
101 .fops = &mmapper_fops 102 .fops = &mmapper_fops
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index f3a3f8a29c7a..0ffd7ac295d4 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -18,6 +18,7 @@
18#include "kern_util.h" 18#include "kern_util.h"
19#include "net_user.h" 19#include "net_user.h"
20#include "os.h" 20#include "os.h"
21#include "um_malloc.h"
21 22
22int tap_open_common(void *dev, char *gate_addr) 23int tap_open_common(void *dev, char *gate_addr)
23{ 24{
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index 2ef641ded960..11921a7baa7b 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -12,6 +12,7 @@
12#include "net_user.h" 12#include "net_user.h"
13#include "pcap_user.h" 13#include "pcap_user.h"
14#include "user.h" 14#include "user.h"
15#include "um_malloc.h"
15 16
16#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER) 17#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)
17 18
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index f2e8fc42ecc2..bc6afaf74c1a 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -19,6 +19,7 @@
19#include "chan_user.h" 19#include "chan_user.h"
20#include "port.h" 20#include "port.h"
21#include "os.h" 21#include "os.h"
22#include "um_malloc.h"
22 23
23struct port_chan { 24struct port_chan {
24 int raw; 25 int raw;
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index abec620e8380..829a5eca8c07 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -13,6 +13,7 @@
13#include "user_util.h" 13#include "user_util.h"
14#include "kern_util.h" 14#include "kern_util.h"
15#include "os.h" 15#include "os.h"
16#include "um_malloc.h"
16 17
17struct pty_chan { 18struct pty_chan {
18 void (*announce)(char *dev_name, int dev); 19 void (*announce)(char *dev_name, int dev);
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 8460285c69a5..7eddacc53b6e 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -15,6 +15,7 @@
15#include "slip.h" 15#include "slip.h"
16#include "slip_common.h" 16#include "slip_common.h"
17#include "os.h" 17#include "os.h"
18#include "um_malloc.h"
18 19
19void slip_user_init(void *data, void *dev) 20void slip_user_init(void *data, void *dev)
20{ 21{
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index 11de3ac1eb5c..d95d64309eaf 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -11,6 +11,7 @@
11#include "user_util.h" 11#include "user_util.h"
12#include "user.h" 12#include "user.h"
13#include "os.h" 13#include "os.h"
14#include "um_malloc.h"
14 15
15struct tty_chan { 16struct tty_chan {
16 char *dev; 17 char *dev;
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 386f8b952982..850221d9b4c9 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -136,8 +136,6 @@ int xterm_open(int input, int output, int primary, void *d,
136 return(pid); 136 return(pid);
137 } 137 }
138 138
139 if(data->stack == 0) free_stack(stack, 0);
140
141 if (data->direct_rcv) { 139 if (data->direct_rcv) {
142 new = os_rcv_fd(fd, &data->helper_pid); 140 new = os_rcv_fd(fd, &data->helper_pid);
143 } else { 141 } else {
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
new file mode 100644
index 000000000000..0363a9b53f8d
--- /dev/null
+++ b/arch/um/include/um_malloc.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_MALLOC_H__
7#define __UM_MALLOC_H__
8
9extern void *um_kmalloc(int size);
10extern void *um_kmalloc_atomic(int size);
11extern void kfree(const void *ptr);
12
13extern void *um_vmalloc(int size);
14extern void *um_vmalloc_atomic(int size);
15extern void vfree(void *ptr);
16
17#endif /* __UM_MALLOC_H__ */
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 39f8c8801076..acadce3f271f 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -11,17 +11,11 @@ extern void panic(const char *fmt, ...)
11extern int printk(const char *fmt, ...) 11extern int printk(const char *fmt, ...)
12 __attribute__ ((format (printf, 1, 2))); 12 __attribute__ ((format (printf, 1, 2)));
13extern void schedule(void); 13extern void schedule(void);
14extern void *um_kmalloc(int size);
15extern void *um_kmalloc_atomic(int size);
16extern void kfree(void *ptr);
17extern int in_aton(char *str); 14extern int in_aton(char *str);
18extern int open_gdb_chan(void); 15extern int open_gdb_chan(void);
19/* These use size_t, however unsigned long is correct on both i386 and x86_64. */ 16/* These use size_t, however unsigned long is correct on both i386 and x86_64. */
20extern unsigned long strlcpy(char *, const char *, unsigned long); 17extern unsigned long strlcpy(char *, const char *, unsigned long);
21extern unsigned long strlcat(char *, const char *, unsigned long); 18extern unsigned long strlcat(char *, const char *, unsigned long);
22extern void *um_vmalloc(int size);
23extern void *um_vmalloc_atomic(int size);
24extern void vfree(void *ptr);
25 19
26#endif 20#endif
27 21
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index 802d7842514d..06625fefef33 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -52,7 +52,6 @@ extern int linux_main(int argc, char **argv);
52extern void set_cmdline(char *cmd); 52extern void set_cmdline(char *cmd);
53extern void input_cb(void (*proc)(void *), void *arg, int arg_len); 53extern void input_cb(void (*proc)(void *), void *arg, int arg_len);
54extern int get_pty(void); 54extern int get_pty(void);
55extern void *um_kmalloc(int size);
56extern int switcheroo(int fd, int prot, void *from, void *to, int size); 55extern int switcheroo(int fd, int prot, void *from, void *to, int size);
57extern void do_exec(int old_pid, int new_pid); 56extern void do_exec(int old_pid, int new_pid);
58extern void tracer_panic(char *msg, ...) 57extern void tracer_panic(char *msg, ...)
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index ef259569fd8c..5c1e611f628d 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -31,6 +31,7 @@
31#include "irq_kern.h" 31#include "irq_kern.h"
32#include "os.h" 32#include "os.h"
33#include "sigio.h" 33#include "sigio.h"
34#include "um_malloc.h"
34#include "misc_constants.h" 35#include "misc_constants.h"
35 36
36/* 37/*
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fe6c64abda5b..348b272bb766 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -46,6 +46,7 @@
46#include "mode.h" 46#include "mode.h"
47#include "mode_kern.h" 47#include "mode_kern.h"
48#include "choose-mode.h" 48#include "choose-mode.h"
49#include "um_malloc.h"
49 50
50/* This is a per-cpu array. A processor only modifies its entry and it only 51/* This is a per-cpu array. A processor only modifies its entry and it only
51 * cares about its entry, so it's OK if another processor is modifying its 52 * cares about its entry, so it's OK if another processor is modifying its
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index f559bdf746e6..863981ba1468 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -20,6 +20,7 @@
20#include "net_user.h" 20#include "net_user.h"
21#include "etap.h" 21#include "etap.h"
22#include "os.h" 22#include "os.h"
23#include "um_malloc.h"
23 24
24#define MAX_PACKET ETH_MAX_PACKET 25#define MAX_PACKET ETH_MAX_PACKET
25 26
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index cd15b9df5b5c..d13299cfa318 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -35,22 +35,23 @@ static int helper_child(void *arg)
35 char **argv = data->argv; 35 char **argv = data->argv;
36 int errval; 36 int errval;
37 37
38 if(helper_pause){ 38 if (helper_pause){
39 signal(SIGHUP, helper_hup); 39 signal(SIGHUP, helper_hup);
40 pause(); 40 pause();
41 } 41 }
42 if(data->pre_exec != NULL) 42 if (data->pre_exec != NULL)
43 (*data->pre_exec)(data->pre_data); 43 (*data->pre_exec)(data->pre_data);
44 execvp(argv[0], argv); 44 execvp(argv[0], argv);
45 errval = -errno; 45 errval = -errno;
46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); 46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno);
47 os_write_file(data->fd, &errval, sizeof(errval)); 47 os_write_file(data->fd, &errval, sizeof(errval));
48 kill(os_getpid(), SIGKILL); 48 kill(os_getpid(), SIGKILL);
49 return(0); 49 return 0;
50} 50}
51 51
52/* Returns either the pid of the child process we run or -E* on failure. 52/* Returns either the pid of the child process we run or -E* on failure.
53 * XXX The alloc_stack here breaks if this is called in the tracing thread */ 53 * XXX The alloc_stack here breaks if this is called in the tracing thread, so
54 * we need to receive a preallocated stack (a local buffer is ok). */
54int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, 55int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
55 unsigned long *stack_out) 56 unsigned long *stack_out)
56{ 57{
@@ -58,20 +59,21 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
58 unsigned long stack, sp; 59 unsigned long stack, sp;
59 int pid, fds[2], ret, n; 60 int pid, fds[2], ret, n;
60 61
61 if((stack_out != NULL) && (*stack_out != 0)) 62 if ((stack_out != NULL) && (*stack_out != 0))
62 stack = *stack_out; 63 stack = *stack_out;
63 else stack = alloc_stack(0, __cant_sleep()); 64 else
64 if(stack == 0) 65 stack = alloc_stack(0, __cant_sleep());
66 if (stack == 0)
65 return -ENOMEM; 67 return -ENOMEM;
66 68
67 ret = os_pipe(fds, 1, 0); 69 ret = os_pipe(fds, 1, 0);
68 if(ret < 0){ 70 if (ret < 0) {
69 printk("run_helper : pipe failed, ret = %d\n", -ret); 71 printk("run_helper : pipe failed, ret = %d\n", -ret);
70 goto out_free; 72 goto out_free;
71 } 73 }
72 74
73 ret = os_set_exec_close(fds[1], 1); 75 ret = os_set_exec_close(fds[1], 1);
74 if(ret < 0){ 76 if (ret < 0) {
75 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", 77 printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n",
76 -ret); 78 -ret);
77 goto out_close; 79 goto out_close;
@@ -83,7 +85,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
83 data.argv = argv; 85 data.argv = argv;
84 data.fd = fds[1]; 86 data.fd = fds[1];
85 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); 87 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data);
86 if(pid < 0){ 88 if (pid < 0) {
87 ret = -errno; 89 ret = -errno;
88 printk("run_helper : clone failed, errno = %d\n", errno); 90 printk("run_helper : clone failed, errno = %d\n", errno);
89 goto out_close; 91 goto out_close;
@@ -95,10 +97,10 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
95 /* Read the errno value from the child, if the exec failed, or get 0 if 97 /* Read the errno value from the child, if the exec failed, or get 0 if
96 * the exec succeeded because the pipe fd was set as close-on-exec. */ 98 * the exec succeeded because the pipe fd was set as close-on-exec. */
97 n = os_read_file(fds[0], &ret, sizeof(ret)); 99 n = os_read_file(fds[0], &ret, sizeof(ret));
98 if(n == 0) 100 if (n == 0) {
99 ret = pid; 101 ret = pid;
100 else { 102 } else {
101 if(n < 0){ 103 if (n < 0) {
102 printk("run_helper : read on pipe failed, ret = %d\n", 104 printk("run_helper : read on pipe failed, ret = %d\n",
103 -n); 105 -n);
104 ret = n; 106 ret = n;
@@ -112,10 +114,9 @@ out_close:
112 close(fds[1]); 114 close(fds[1]);
113 close(fds[0]); 115 close(fds[0]);
114out_free: 116out_free:
115 if(stack_out == NULL) 117 if ((stack_out == NULL) || (*stack_out == 0))
116 free_stack(stack, 0); 118 free_stack(stack, 0);
117 else *stack_out = stack; 119 return ret;
118 return(ret);
119} 120}
120 121
121int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, 122int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
@@ -125,31 +126,32 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
125 int pid, status, err; 126 int pid, status, err;
126 127
127 stack = alloc_stack(stack_order, __cant_sleep()); 128 stack = alloc_stack(stack_order, __cant_sleep());
128 if(stack == 0) return(-ENOMEM); 129 if (stack == 0)
130 return -ENOMEM;
129 131
130 sp = stack + (page_size() << stack_order) - sizeof(void *); 132 sp = stack + (page_size() << stack_order) - sizeof(void *);
131 pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); 133 pid = clone(proc, (void *) sp, flags | SIGCHLD, arg);
132 if(pid < 0){ 134 if (pid < 0) {
133 err = -errno; 135 err = -errno;
134 printk("run_helper_thread : clone failed, errno = %d\n", 136 printk("run_helper_thread : clone failed, errno = %d\n",
135 errno); 137 errno);
136 return err; 138 return err;
137 } 139 }
138 if(stack_out == NULL){ 140 if (stack_out == NULL) {
139 CATCH_EINTR(pid = waitpid(pid, &status, 0)); 141 CATCH_EINTR(pid = waitpid(pid, &status, 0));
140 if(pid < 0){ 142 if (pid < 0) {
141 err = -errno; 143 err = -errno;
142 printk("run_helper_thread - wait failed, errno = %d\n", 144 printk("run_helper_thread - wait failed, errno = %d\n",
143 errno); 145 errno);
144 pid = err; 146 pid = err;
145 } 147 }
146 if(!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) 148 if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0))
147 printk("run_helper_thread - thread returned status " 149 printk("run_helper_thread - thread returned status "
148 "0x%x\n", status); 150 "0x%x\n", status);
149 free_stack(stack, stack_order); 151 free_stack(stack, stack_order);
150 } 152 } else
151 else *stack_out = stack; 153 *stack_out = stack;
152 return(pid); 154 return pid;
153} 155}
154 156
155int helper_wait(int pid) 157int helper_wait(int pid)
@@ -157,9 +159,9 @@ int helper_wait(int pid)
157 int ret; 159 int ret;
158 160
159 CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); 161 CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG));
160 if(ret < 0){ 162 if (ret < 0) {
161 ret = -errno; 163 ret = -errno;
162 printk("helper_wait : waitpid failed, errno = %d\n", errno); 164 printk("helper_wait : waitpid failed, errno = %d\n", errno);
163 } 165 }
164 return(ret); 166 return ret;
165} 167}
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index a97206df5b52..d46b818c1311 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -18,6 +18,7 @@
18#include "sigio.h" 18#include "sigio.h"
19#include "irq_user.h" 19#include "irq_user.h"
20#include "os.h" 20#include "os.h"
21#include "um_malloc.h"
21 22
22static struct pollfd *pollfds = NULL; 23static struct pollfd *pollfds = NULL;
23static int pollfds_num = 0; 24static int pollfds_num = 0;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index d1c5670787dc..685feaab65d2 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -23,6 +23,7 @@
23#include "choose-mode.h" 23#include "choose-mode.h"
24#include "uml-config.h" 24#include "uml-config.h"
25#include "os.h" 25#include "os.h"
26#include "um_malloc.h"
26 27
27/* Set in set_stklim, which is called from main and __wrap_malloc. 28/* Set in set_stklim, which is called from main and __wrap_malloc.
28 * __wrap_malloc only calls it if main hasn't started. 29 * __wrap_malloc only calls it if main hasn't started.
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index f6457765b17d..925a65240cfe 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -19,6 +19,7 @@
19#include "user_util.h" 19#include "user_util.h"
20#include "sigio.h" 20#include "sigio.h"
21#include "os.h" 21#include "os.h"
22#include "um_malloc.h"
22 23
23/* Protected by sigio_lock(), also used by sigio_cleanup, which is an 24/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
24 * exitcall. 25 * exitcall.
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 38be096e750f..2115b8beb541 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -16,6 +16,7 @@
16#include "process.h" 16#include "process.h"
17#include "kern_constants.h" 17#include "kern_constants.h"
18#include "os.h" 18#include "os.h"
19#include "uml-config.h"
19 20
20int set_interval(int is_virtual) 21int set_interval(int is_virtual)
21{ 22{
@@ -30,7 +31,7 @@ int set_interval(int is_virtual)
30 return 0; 31 return 0;
31} 32}
32 33
33#ifdef CONFIG_MODE_TT 34#ifdef UML_CONFIG_MODE_TT
34void enable_timer(void) 35void enable_timer(void)
35{ 36{
36 set_interval(1); 37 set_interval(1);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index c847e17e5caa..136066583c68 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -56,11 +56,6 @@ static kmem_cache_t *requestq_cachep;
56 */ 56 */
57static kmem_cache_t *iocontext_cachep; 57static kmem_cache_t *iocontext_cachep;
58 58
59static wait_queue_head_t congestion_wqh[2] = {
60 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
61 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
62 };
63
64/* 59/*
65 * Controlling structure to kblockd 60 * Controlling structure to kblockd
66 */ 61 */
@@ -112,35 +107,6 @@ static void blk_queue_congestion_threshold(struct request_queue *q)
112 q->nr_congestion_off = nr; 107 q->nr_congestion_off = nr;
113} 108}
114 109
115/*
116 * A queue has just exitted congestion. Note this in the global counter of
117 * congested queues, and wake up anyone who was waiting for requests to be
118 * put back.
119 */
120static void clear_queue_congested(request_queue_t *q, int rw)
121{
122 enum bdi_state bit;
123 wait_queue_head_t *wqh = &congestion_wqh[rw];
124
125 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
126 clear_bit(bit, &q->backing_dev_info.state);
127 smp_mb__after_clear_bit();
128 if (waitqueue_active(wqh))
129 wake_up(wqh);
130}
131
132/*
133 * A queue has just entered congestion. Flag that in the queue's VM-visible
134 * state flags and increment the global gounter of congested queues.
135 */
136static void set_queue_congested(request_queue_t *q, int rw)
137{
138 enum bdi_state bit;
139
140 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
141 set_bit(bit, &q->backing_dev_info.state);
142}
143
144/** 110/**
145 * blk_get_backing_dev_info - get the address of a queue's backing_dev_info 111 * blk_get_backing_dev_info - get the address of a queue's backing_dev_info
146 * @bdev: device 112 * @bdev: device
@@ -159,7 +125,6 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev)
159 ret = &q->backing_dev_info; 125 ret = &q->backing_dev_info;
160 return ret; 126 return ret;
161} 127}
162
163EXPORT_SYMBOL(blk_get_backing_dev_info); 128EXPORT_SYMBOL(blk_get_backing_dev_info);
164 129
165void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data) 130void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
@@ -167,7 +132,6 @@ void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
167 q->activity_fn = fn; 132 q->activity_fn = fn;
168 q->activity_data = data; 133 q->activity_data = data;
169} 134}
170
171EXPORT_SYMBOL(blk_queue_activity_fn); 135EXPORT_SYMBOL(blk_queue_activity_fn);
172 136
173/** 137/**
@@ -2067,7 +2031,7 @@ static void __freed_request(request_queue_t *q, int rw)
2067 struct request_list *rl = &q->rq; 2031 struct request_list *rl = &q->rq;
2068 2032
2069 if (rl->count[rw] < queue_congestion_off_threshold(q)) 2033 if (rl->count[rw] < queue_congestion_off_threshold(q))
2070 clear_queue_congested(q, rw); 2034 blk_clear_queue_congested(q, rw);
2071 2035
2072 if (rl->count[rw] + 1 <= q->nr_requests) { 2036 if (rl->count[rw] + 1 <= q->nr_requests) {
2073 if (waitqueue_active(&rl->wait[rw])) 2037 if (waitqueue_active(&rl->wait[rw]))
@@ -2137,7 +2101,7 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
2137 } 2101 }
2138 } 2102 }
2139 } 2103 }
2140 set_queue_congested(q, rw); 2104 blk_set_queue_congested(q, rw);
2141 } 2105 }
2142 2106
2143 /* 2107 /*
@@ -2755,41 +2719,6 @@ void blk_end_sync_rq(struct request *rq, int error)
2755} 2719}
2756EXPORT_SYMBOL(blk_end_sync_rq); 2720EXPORT_SYMBOL(blk_end_sync_rq);
2757 2721
2758/**
2759 * blk_congestion_wait - wait for a queue to become uncongested
2760 * @rw: READ or WRITE
2761 * @timeout: timeout in jiffies
2762 *
2763 * Waits for up to @timeout jiffies for a queue (any queue) to exit congestion.
2764 * If no queues are congested then just wait for the next request to be
2765 * returned.
2766 */
2767long blk_congestion_wait(int rw, long timeout)
2768{
2769 long ret;
2770 DEFINE_WAIT(wait);
2771 wait_queue_head_t *wqh = &congestion_wqh[rw];
2772
2773 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
2774 ret = io_schedule_timeout(timeout);
2775 finish_wait(wqh, &wait);
2776 return ret;
2777}
2778
2779EXPORT_SYMBOL(blk_congestion_wait);
2780
2781/**
2782 * blk_congestion_end - wake up sleepers on a congestion queue
2783 * @rw: READ or WRITE
2784 */
2785void blk_congestion_end(int rw)
2786{
2787 wait_queue_head_t *wqh = &congestion_wqh[rw];
2788
2789 if (waitqueue_active(wqh))
2790 wake_up(wqh);
2791}
2792
2793/* 2722/*
2794 * Has to be called with the request spinlock acquired 2723 * Has to be called with the request spinlock acquired
2795 */ 2724 */
@@ -3765,14 +3694,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
3765 blk_queue_congestion_threshold(q); 3694 blk_queue_congestion_threshold(q);
3766 3695
3767 if (rl->count[READ] >= queue_congestion_on_threshold(q)) 3696 if (rl->count[READ] >= queue_congestion_on_threshold(q))
3768 set_queue_congested(q, READ); 3697 blk_set_queue_congested(q, READ);
3769 else if (rl->count[READ] < queue_congestion_off_threshold(q)) 3698 else if (rl->count[READ] < queue_congestion_off_threshold(q))
3770 clear_queue_congested(q, READ); 3699 blk_clear_queue_congested(q, READ);
3771 3700
3772 if (rl->count[WRITE] >= queue_congestion_on_threshold(q)) 3701 if (rl->count[WRITE] >= queue_congestion_on_threshold(q))
3773 set_queue_congested(q, WRITE); 3702 blk_set_queue_congested(q, WRITE);
3774 else if (rl->count[WRITE] < queue_congestion_off_threshold(q)) 3703 else if (rl->count[WRITE] < queue_congestion_off_threshold(q))
3775 clear_queue_congested(q, WRITE); 3704 blk_clear_queue_congested(q, WRITE);
3776 3705
3777 if (rl->count[READ] >= q->nr_requests) { 3706 if (rl->count[READ] >= q->nr_requests) {
3778 blk_set_queue_full(q, READ); 3707 blk_set_queue_full(q, READ);
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 98099de59b45..6bcd9e8e7bcb 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -85,6 +85,8 @@ struct acpi_memory_device {
85 struct list_head res_list; 85 struct list_head res_list;
86}; 86};
87 87
88static int acpi_hotmem_initialized;
89
88static acpi_status 90static acpi_status
89acpi_memory_get_resource(struct acpi_resource *resource, void *context) 91acpi_memory_get_resource(struct acpi_resource *resource, void *context)
90{ 92{
@@ -414,7 +416,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
414 /* Set the device state */ 416 /* Set the device state */
415 mem_device->state = MEMORY_POWER_ON_STATE; 417 mem_device->state = MEMORY_POWER_ON_STATE;
416 418
417 printk(KERN_INFO "%s \n", acpi_device_name(device)); 419 printk(KERN_DEBUG "%s \n", acpi_device_name(device));
418 420
419 return result; 421 return result;
420} 422}
@@ -438,6 +440,15 @@ static int acpi_memory_device_start (struct acpi_device *device)
438 struct acpi_memory_device *mem_device; 440 struct acpi_memory_device *mem_device;
439 int result = 0; 441 int result = 0;
440 442
443 /*
444 * Early boot code has recognized memory area by EFI/E820.
445 * If DSDT shows these memory devices on boot, hotplug is not necessary
446 * for them. So, it just returns until completion of this driver's
447 * start up.
448 */
449 if (!acpi_hotmem_initialized)
450 return 0;
451
441 mem_device = acpi_driver_data(device); 452 mem_device = acpi_driver_data(device);
442 453
443 if (!acpi_memory_check_device(mem_device)) { 454 if (!acpi_memory_check_device(mem_device)) {
@@ -537,6 +548,7 @@ static int __init acpi_memory_device_init(void)
537 return -ENODEV; 548 return -ENODEV;
538 } 549 }
539 550
551 acpi_hotmem_initialized = 1;
540 return 0; 552 return 0;
541} 553}
542 554
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e67144cf3c8b..65b3f056ad89 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -962,7 +962,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
962 962
963 result = acpi_processor_get_power_info_cst(pr); 963 result = acpi_processor_get_power_info_cst(pr);
964 if (result == -ENODEV) 964 if (result == -ENODEV)
965 acpi_processor_get_power_info_fadt(pr); 965 result = acpi_processor_get_power_info_fadt(pr);
966 966
967 if (result) 967 if (result)
968 return result; 968 return result;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index e7c800f4c3ad..07eafbc5dc3a 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -711,6 +711,7 @@ static void dtl1_release(struct pcmcia_device *link)
711 711
712static struct pcmcia_device_id dtl1_ids[] = { 712static struct pcmcia_device_id dtl1_ids[] = {
713 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 713 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
714 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-4", 0xe1bfdd64, 0x9102bc82),
714 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863), 715 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863),
715 PCMCIA_DEVICE_PROD_ID12("Socket", "CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3), 716 PCMCIA_DEVICE_PROD_ID12("Socket", "CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3),
716 PCMCIA_DEVICE_NULL 717 PCMCIA_DEVICE_NULL
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 7565642a007a..fdea58ae16b2 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -118,6 +118,9 @@ static struct usb_device_id blacklist_ids[] = {
118 /* IBM/Lenovo ThinkPad with Broadcom chip */ 118 /* IBM/Lenovo ThinkPad with Broadcom chip */
119 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, 119 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU },
120 120
121 /* ANYCOM Bluetooth USB-200 and USB-250 */
122 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
123
121 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ 124 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
122 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, 125 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
123 126
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 24825bdca8f4..e5cfb1fa47d1 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1789,7 +1789,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
1789 1789
1790 info = kzalloc(sizeof(*info), GFP_KERNEL); 1790 info = kzalloc(sizeof(*info), GFP_KERNEL);
1791 if (!info) 1791 if (!info)
1792 return ENOMEM; 1792 return -ENOMEM;
1793 1793
1794 info->addr_source = "PCI"; 1794 info->addr_source = "PCI";
1795 1795
@@ -1810,7 +1810,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
1810 kfree(info); 1810 kfree(info);
1811 printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", 1811 printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n",
1812 pci_name(pdev), class_type); 1812 pci_name(pdev), class_type);
1813 return ENOMEM; 1813 return -ENOMEM;
1814 } 1814 }
1815 1815
1816 rv = pci_enable_device(pdev); 1816 rv = pci_enable_device(pdev);
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 8bcb58cd4ac0..1865b56fb141 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * See Documentation/dcdbas.txt for more information. 9 * See Documentation/dcdbas.txt for more information.
10 * 10 *
11 * Copyright (C) 1995-2005 Dell Inc. 11 * Copyright (C) 1995-2006 Dell Inc.
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License v2.0 as published by 14 * it under the terms of the GNU General Public License v2.0 as published by
@@ -40,7 +40,7 @@
40#include "dcdbas.h" 40#include "dcdbas.h"
41 41
42#define DRIVER_NAME "dcdbas" 42#define DRIVER_NAME "dcdbas"
43#define DRIVER_VERSION "5.6.0-2" 43#define DRIVER_VERSION "5.6.0-3.2"
44#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver" 44#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver"
45 45
46static struct platform_device *dcdbas_pdev; 46static struct platform_device *dcdbas_pdev;
@@ -175,6 +175,9 @@ static ssize_t smi_data_write(struct kobject *kobj, char *buf, loff_t pos,
175{ 175{
176 ssize_t ret; 176 ssize_t ret;
177 177
178 if ((pos + count) > MAX_SMI_DATA_BUF_SIZE)
179 return -EINVAL;
180
178 mutex_lock(&smi_data_lock); 181 mutex_lock(&smi_data_lock);
179 182
180 ret = smi_data_buf_realloc(pos + count); 183 ret = smi_data_buf_realloc(pos + count);
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 7e95f04f13da..3dacfff93f5f 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs)
716 716
717 *cfg = 0; /* disable INT0/1 */ 717 *cfg = 0; /* disable INT0/1 */
718 *cfg = 2; /* reset pending INT0 */ 718 *cfg = 2; /* reset pending INT0 */
719 iounmap((void *)cs->hw.diva.cfg_reg); 719 if (cs->hw.diva.cfg_reg)
720 iounmap((void *)cs->hw.diva.pci_cfg); 720 iounmap((void *)cs->hw.diva.cfg_reg);
721 if (cs->hw.diva.pci_cfg)
722 iounmap((void *)cs->hw.diva.pci_cfg);
721 return; 723 return;
722 } else if (cs->subtyp != DIVA_IPAC_ISA) { 724 } else if (cs->subtyp != DIVA_IPAC_ISA) {
723 del_timer(&cs->hw.diva.tl); 725 del_timer(&cs->hw.diva.tl);
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs)
734} 736}
735 737
736static void 738static void
739iounmap_diva(struct IsdnCardState *cs)
740{
741 if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_IPACX_PCI)) {
742 if (cs->hw.diva.cfg_reg) {
743 iounmap((void *)cs->hw.diva.cfg_reg);
744 cs->hw.diva.cfg_reg = 0;
745 }
746 if (cs->hw.diva.pci_cfg) {
747 iounmap((void *)cs->hw.diva.pci_cfg);
748 cs->hw.diva.pci_cfg = 0;
749 }
750 }
751
752 return;
753}
754
755static void
737reset_diva(struct IsdnCardState *cs) 756reset_diva(struct IsdnCardState *cs)
738{ 757{
739 if (cs->subtyp == DIVA_IPAC_ISA) { 758 if (cs->subtyp == DIVA_IPAC_ISA) {
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card)
1069 1088
1070 if (!cs->irq) { 1089 if (!cs->irq) {
1071 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n"); 1090 printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
1091 iounmap_diva(cs);
1072 return(0); 1092 return(0);
1073 } 1093 }
1074 1094
1075 if (!cs->hw.diva.cfg_reg) { 1095 if (!cs->hw.diva.cfg_reg) {
1076 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); 1096 printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
1097 iounmap_diva(cs);
1077 return(0); 1098 return(0);
1078 } 1099 }
1079 cs->irq_flags |= IRQF_SHARED; 1100 cs->irq_flags |= IRQF_SHARED;
@@ -1123,6 +1144,7 @@ ready:
1123 CardType[card->typ], 1144 CardType[card->typ],
1124 cs->hw.diva.cfg_reg, 1145 cs->hw.diva.cfg_reg,
1125 cs->hw.diva.cfg_reg + bytecnt); 1146 cs->hw.diva.cfg_reg + bytecnt);
1147 iounmap_diva(cs);
1126 return (0); 1148 return (0);
1127 } 1149 }
1128 } 1150 }
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index 8bbe33ae06db..82e42a80dc4b 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -403,7 +403,7 @@ ergo_releasehardware(hysdn_card * card)
403 free_irq(card->irq, card); /* release interrupt */ 403 free_irq(card->irq, card); /* release interrupt */
404 release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */ 404 release_region(card->iobase + PCI9050_INTR_REG, 1); /* release all io ports */
405 release_region(card->iobase + PCI9050_USER_IO, 1); 405 release_region(card->iobase + PCI9050_USER_IO, 1);
406 vfree(card->dpram); 406 iounmap(card->dpram);
407 card->dpram = NULL; /* release shared mem */ 407 card->dpram = NULL; /* release shared mem */
408} /* ergo_releasehardware */ 408} /* ergo_releasehardware */
409 409
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 655d816760e5..a625576fdeeb 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/crypto.h> 17#include <linux/crypto.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/backing-dev.h>
19#include <asm/atomic.h> 20#include <asm/atomic.h>
20#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
21#include <asm/page.h> 22#include <asm/page.h>
@@ -602,7 +603,7 @@ static void process_write(struct crypt_io *io)
602 603
603 /* out of memory -> run queues */ 604 /* out of memory -> run queues */
604 if (remaining) 605 if (remaining)
605 blk_congestion_wait(bio_data_dir(clone), HZ/100); 606 congestion_wait(bio_data_dir(clone), HZ/100);
606 } 607 }
607} 608}
608 609
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 27d5d2f02533..a3a08a5dd185 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2039,7 +2039,6 @@ static int e100_change_mtu(struct net_device *netdev, int new_mtu)
2039 return 0; 2039 return 0;
2040} 2040}
2041 2041
2042#ifdef CONFIG_PM
2043static int e100_asf(struct nic *nic) 2042static int e100_asf(struct nic *nic)
2044{ 2043{
2045 /* ASF can be enabled from eeprom */ 2044 /* ASF can be enabled from eeprom */
@@ -2048,7 +2047,6 @@ static int e100_asf(struct nic *nic)
2048 !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && 2047 !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) &&
2049 ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE)); 2048 ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE));
2050} 2049}
2051#endif
2052 2050
2053static int e100_up(struct nic *nic) 2051static int e100_up(struct nic *nic)
2054{ 2052{
@@ -2715,34 +2713,32 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2715 } 2713 }
2716} 2714}
2717 2715
2716#ifdef CONFIG_PM
2718static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2717static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2719{ 2718{
2720 struct net_device *netdev = pci_get_drvdata(pdev); 2719 struct net_device *netdev = pci_get_drvdata(pdev);
2721 struct nic *nic = netdev_priv(netdev); 2720 struct nic *nic = netdev_priv(netdev);
2722 2721
2723 if (netif_running(netdev)) 2722 netif_poll_disable(nic->netdev);
2724 e100_down(nic); 2723 del_timer_sync(&nic->watchdog);
2725 e100_hw_reset(nic); 2724 netif_carrier_off(nic->netdev);
2726 netif_device_detach(netdev);
2727 2725
2728#ifdef CONFIG_PM
2729 pci_save_state(pdev); 2726 pci_save_state(pdev);
2730 if (nic->flags & (wol_magic | e100_asf(nic))) 2727
2731#else 2728 if ((nic->flags & wol_magic) | e100_asf(nic)) {
2732 if (nic->flags & (wol_magic)) 2729 pci_enable_wake(pdev, PCI_D3hot, 1);
2733#endif 2730 pci_enable_wake(pdev, PCI_D3cold, 1);
2734 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); 2731 } else {
2735 else 2732 pci_enable_wake(pdev, PCI_D3hot, 0);
2736 /* disable PME */ 2733 pci_enable_wake(pdev, PCI_D3cold, 0);
2737 pci_enable_wake(pdev, 0, 0); 2734 }
2738 2735
2739 pci_disable_device(pdev); 2736 pci_disable_device(pdev);
2740 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2737 pci_set_power_state(pdev, PCI_D3hot);
2741 2738
2742 return 0; 2739 return 0;
2743} 2740}
2744 2741
2745#ifdef CONFIG_PM
2746static int e100_resume(struct pci_dev *pdev) 2742static int e100_resume(struct pci_dev *pdev)
2747{ 2743{
2748 struct net_device *netdev = pci_get_drvdata(pdev); 2744 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2764,7 +2760,23 @@ static int e100_resume(struct pci_dev *pdev)
2764 2760
2765static void e100_shutdown(struct pci_dev *pdev) 2761static void e100_shutdown(struct pci_dev *pdev)
2766{ 2762{
2767 e100_suspend(pdev, PMSG_SUSPEND); 2763 struct net_device *netdev = pci_get_drvdata(pdev);
2764 struct nic *nic = netdev_priv(netdev);
2765
2766 netif_poll_disable(nic->netdev);
2767 del_timer_sync(&nic->watchdog);
2768 netif_carrier_off(nic->netdev);
2769
2770 if ((nic->flags & wol_magic) | e100_asf(nic)) {
2771 pci_enable_wake(pdev, PCI_D3hot, 1);
2772 pci_enable_wake(pdev, PCI_D3cold, 1);
2773 } else {
2774 pci_enable_wake(pdev, PCI_D3hot, 0);
2775 pci_enable_wake(pdev, PCI_D3cold, 0);
2776 }
2777
2778 pci_disable_device(pdev);
2779 pci_set_power_state(pdev, PCI_D3hot);
2768} 2780}
2769 2781
2770/* ------------------ PCI Error Recovery infrastructure -------------- */ 2782/* ------------------ PCI Error Recovery infrastructure -------------- */
@@ -2848,9 +2860,9 @@ static struct pci_driver e100_driver = {
2848 .id_table = e100_id_table, 2860 .id_table = e100_id_table,
2849 .probe = e100_probe, 2861 .probe = e100_probe,
2850 .remove = __devexit_p(e100_remove), 2862 .remove = __devexit_p(e100_remove),
2863#ifdef CONFIG_PM
2851 /* Power Management hooks */ 2864 /* Power Management hooks */
2852 .suspend = e100_suspend, 2865 .suspend = e100_suspend,
2853#ifdef CONFIG_PM
2854 .resume = e100_resume, 2866 .resume = e100_resume,
2855#endif 2867#endif
2856 .shutdown = e100_shutdown, 2868 .shutdown = e100_shutdown,
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 4178b4b1d2df..82c10dec1b5a 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -58,7 +58,11 @@
58#include <linux/tcp.h> 58#include <linux/tcp.h>
59#include <linux/percpu.h> 59#include <linux/percpu.h>
60 60
61static DEFINE_PER_CPU(struct net_device_stats, loopback_stats); 61struct pcpu_lstats {
62 unsigned long packets;
63 unsigned long bytes;
64};
65static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats);
62 66
63#define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16) 67#define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16)
64 68
@@ -128,7 +132,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
128 */ 132 */
129static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) 133static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
130{ 134{
131 struct net_device_stats *lb_stats; 135 struct pcpu_lstats *lb_stats;
132 136
133 skb_orphan(skb); 137 skb_orphan(skb);
134 138
@@ -149,16 +153,14 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
149#endif 153#endif
150 dev->last_rx = jiffies; 154 dev->last_rx = jiffies;
151 155
152 lb_stats = &per_cpu(loopback_stats, get_cpu()); 156 /* it's OK to use __get_cpu_var() because BHs are off */
153 lb_stats->rx_bytes += skb->len; 157 lb_stats = &__get_cpu_var(pcpu_lstats);
154 lb_stats->tx_bytes = lb_stats->rx_bytes; 158 lb_stats->bytes += skb->len;
155 lb_stats->rx_packets++; 159 lb_stats->packets++;
156 lb_stats->tx_packets = lb_stats->rx_packets;
157 put_cpu();
158 160
159 netif_rx(skb); 161 netif_rx(skb);
160 162
161 return(0); 163 return 0;
162} 164}
163 165
164static struct net_device_stats loopback_stats; 166static struct net_device_stats loopback_stats;
@@ -166,20 +168,21 @@ static struct net_device_stats loopback_stats;
166static struct net_device_stats *get_stats(struct net_device *dev) 168static struct net_device_stats *get_stats(struct net_device *dev)
167{ 169{
168 struct net_device_stats *stats = &loopback_stats; 170 struct net_device_stats *stats = &loopback_stats;
171 unsigned long bytes = 0;
172 unsigned long packets = 0;
169 int i; 173 int i;
170 174
171 memset(stats, 0, sizeof(struct net_device_stats));
172
173 for_each_possible_cpu(i) { 175 for_each_possible_cpu(i) {
174 struct net_device_stats *lb_stats; 176 const struct pcpu_lstats *lb_stats;
175 177
176 lb_stats = &per_cpu(loopback_stats, i); 178 lb_stats = &per_cpu(pcpu_lstats, i);
177 stats->rx_bytes += lb_stats->rx_bytes; 179 bytes += lb_stats->bytes;
178 stats->tx_bytes += lb_stats->tx_bytes; 180 packets += lb_stats->packets;
179 stats->rx_packets += lb_stats->rx_packets;
180 stats->tx_packets += lb_stats->tx_packets;
181 } 181 }
182 182 stats->rx_packets = packets;
183 stats->tx_packets = packets;
184 stats->rx_bytes = bytes;
185 stats->tx_bytes = bytes;
183 return stats; 186 return stats;
184} 187}
185 188
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 327836b1014e..8e398499c045 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.66" 71#define DRV_MODULE_VERSION "3.67"
72#define DRV_MODULE_RELDATE "September 23, 2006" 72#define DRV_MODULE_RELDATE "October 18, 2006"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -129,7 +129,7 @@
129#define RX_JUMBO_PKT_BUF_SZ (9046 + tp->rx_offset + 64) 129#define RX_JUMBO_PKT_BUF_SZ (9046 + tp->rx_offset + 64)
130 130
131/* minimum number of free TX descriptors required to wake up TX process */ 131/* minimum number of free TX descriptors required to wake up TX process */
132#define TG3_TX_WAKEUP_THRESH (TG3_TX_RING_SIZE / 4) 132#define TG3_TX_WAKEUP_THRESH(tp) ((tp)->tx_pending / 4)
133 133
134/* number of ETHTOOL_GSTATS u64's */ 134/* number of ETHTOOL_GSTATS u64's */
135#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64)) 135#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64))
@@ -3075,10 +3075,10 @@ static void tg3_tx(struct tg3 *tp)
3075 smp_mb(); 3075 smp_mb();
3076 3076
3077 if (unlikely(netif_queue_stopped(tp->dev) && 3077 if (unlikely(netif_queue_stopped(tp->dev) &&
3078 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH))) { 3078 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))) {
3079 netif_tx_lock(tp->dev); 3079 netif_tx_lock(tp->dev);
3080 if (netif_queue_stopped(tp->dev) && 3080 if (netif_queue_stopped(tp->dev) &&
3081 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH)) 3081 (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp)))
3082 netif_wake_queue(tp->dev); 3082 netif_wake_queue(tp->dev);
3083 netif_tx_unlock(tp->dev); 3083 netif_tx_unlock(tp->dev);
3084 } 3084 }
@@ -3928,7 +3928,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3928 tp->tx_prod = entry; 3928 tp->tx_prod = entry;
3929 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { 3929 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) {
3930 netif_stop_queue(dev); 3930 netif_stop_queue(dev);
3931 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) 3931 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp))
3932 netif_wake_queue(tp->dev); 3932 netif_wake_queue(tp->dev);
3933 } 3933 }
3934 3934
@@ -4143,7 +4143,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4143 tp->tx_prod = entry; 4143 tp->tx_prod = entry;
4144 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { 4144 if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) {
4145 netif_stop_queue(dev); 4145 netif_stop_queue(dev);
4146 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) 4146 if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH(tp))
4147 netif_wake_queue(tp->dev); 4147 netif_wake_queue(tp->dev);
4148 } 4148 }
4149 4149
@@ -8106,7 +8106,10 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
8106 8106
8107 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 8107 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
8108 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 8108 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
8109 (ering->tx_pending > TG3_TX_RING_SIZE - 1)) 8109 (ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
8110 (ering->tx_pending <= MAX_SKB_FRAGS) ||
8111 ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_1_BUG) &&
8112 (ering->tx_pending <= (MAX_SKB_FRAGS * 3))))
8110 return -EINVAL; 8113 return -EINVAL;
8111 8114
8112 if (netif_running(dev)) { 8115 if (netif_running(dev)) {
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 811d8840707e..2dbb66d2f0a7 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -203,7 +203,7 @@ static irqreturn_t do_eata_pio_int_handler(int irq, void *dev_id)
203 irqreturn_t ret; 203 irqreturn_t ret;
204 204
205 spin_lock_irqsave(dev->host_lock, flags); 205 spin_lock_irqsave(dev->host_lock, flags);
206 ret = eata_pio_int_handler(irq, dev_id, regs); 206 ret = eata_pio_int_handler(irq, dev_id);
207 spin_unlock_irqrestore(dev->host_lock, flags); 207 spin_unlock_irqrestore(dev->host_lock, flags);
208 return ret; 208 return ret;
209} 209}
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b0d502622d94..0b71e7d18903 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -767,37 +767,37 @@ config SERIAL_CPM_SCC1
767 bool "Support for SCC1 serial port" 767 bool "Support for SCC1 serial port"
768 depends on SERIAL_CPM=y 768 depends on SERIAL_CPM=y
769 help 769 help
770 Select the is option to use SCC1 as a serial port 770 Select this option to use SCC1 as a serial port
771 771
772config SERIAL_CPM_SCC2 772config SERIAL_CPM_SCC2
773 bool "Support for SCC2 serial port" 773 bool "Support for SCC2 serial port"
774 depends on SERIAL_CPM=y 774 depends on SERIAL_CPM=y
775 help 775 help
776 Select the is option to use SCC2 as a serial port 776 Select this option to use SCC2 as a serial port
777 777
778config SERIAL_CPM_SCC3 778config SERIAL_CPM_SCC3
779 bool "Support for SCC3 serial port" 779 bool "Support for SCC3 serial port"
780 depends on SERIAL_CPM=y 780 depends on SERIAL_CPM=y
781 help 781 help
782 Select the is option to use SCC3 as a serial port 782 Select this option to use SCC3 as a serial port
783 783
784config SERIAL_CPM_SCC4 784config SERIAL_CPM_SCC4
785 bool "Support for SCC4 serial port" 785 bool "Support for SCC4 serial port"
786 depends on SERIAL_CPM=y 786 depends on SERIAL_CPM=y
787 help 787 help
788 Select the is option to use SCC4 as a serial port 788 Select this option to use SCC4 as a serial port
789 789
790config SERIAL_CPM_SMC1 790config SERIAL_CPM_SMC1
791 bool "Support for SMC1 serial port" 791 bool "Support for SMC1 serial port"
792 depends on SERIAL_CPM=y 792 depends on SERIAL_CPM=y
793 help 793 help
794 Select the is option to use SMC1 as a serial port 794 Select this option to use SMC1 as a serial port
795 795
796config SERIAL_CPM_SMC2 796config SERIAL_CPM_SMC2
797 bool "Support for SMC2 serial port" 797 bool "Support for SMC2 serial port"
798 depends on SERIAL_CPM=y 798 depends on SERIAL_CPM=y
799 help 799 help
800 Select the is option to use SMC2 as a serial port 800 Select this option to use SMC2 as a serial port
801 801
802config SERIAL_SGI_L1_CONSOLE 802config SERIAL_SGI_L1_CONSOLE
803 bool "SGI Altix L1 serial console support" 803 bool "SGI Altix L1 serial console support"
diff --git a/fs/Kconfig b/fs/Kconfig
index 6a3df055280a..fee318e6f4bb 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -634,6 +634,10 @@ config FUSE_FS
634 If you want to develop a userspace FS, or if you want to use 634 If you want to develop a userspace FS, or if you want to use
635 a filesystem based on FUSE, answer Y or M. 635 a filesystem based on FUSE, answer Y or M.
636 636
637config GENERIC_ACL
638 bool
639 select FS_POSIX_ACL
640
637if BLOCK 641if BLOCK
638menu "CD-ROM/DVD Filesystems" 642menu "CD-ROM/DVD Filesystems"
639 643
@@ -2080,10 +2084,6 @@ config 9P_FS
2080 2084
2081 If unsure, say N. 2085 If unsure, say N.
2082 2086
2083config GENERIC_ACL
2084 bool
2085 select FS_POSIX_ACL
2086
2087endmenu 2087endmenu
2088 2088
2089if BLOCK 2089if BLOCK
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index c7700d9b3f96..906ba5ce2261 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -149,6 +149,7 @@ extern const struct file_operations autofs_root_operations;
149/* Initializing function */ 149/* Initializing function */
150 150
151int autofs_fill_super(struct super_block *, void *, int); 151int autofs_fill_super(struct super_block *, void *, int);
152void autofs_kill_sb(struct super_block *sb);
152 153
153/* Queue management functions */ 154/* Queue management functions */
154 155
diff --git a/fs/autofs/dirhash.c b/fs/autofs/dirhash.c
index 3fded389d06b..bf8c8af98004 100644
--- a/fs/autofs/dirhash.c
+++ b/fs/autofs/dirhash.c
@@ -246,5 +246,4 @@ void autofs_hash_nuke(struct autofs_sb_info *sbi)
246 kfree(ent); 246 kfree(ent);
247 } 247 }
248 } 248 }
249 shrink_dcache_sb(sbi->sb);
250} 249}
diff --git a/fs/autofs/init.c b/fs/autofs/init.c
index aca123752406..cea5219b4f37 100644
--- a/fs/autofs/init.c
+++ b/fs/autofs/init.c
@@ -24,7 +24,7 @@ static struct file_system_type autofs_fs_type = {
24 .owner = THIS_MODULE, 24 .owner = THIS_MODULE,
25 .name = "autofs", 25 .name = "autofs",
26 .get_sb = autofs_get_sb, 26 .get_sb = autofs_get_sb,
27 .kill_sb = kill_anon_super, 27 .kill_sb = autofs_kill_sb,
28}; 28};
29 29
30static int __init init_autofs_fs(void) 30static int __init init_autofs_fs(void)
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 2c9759baad61..54c518c89e4c 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -20,7 +20,7 @@
20#include "autofs_i.h" 20#include "autofs_i.h"
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23static void autofs_put_super(struct super_block *sb) 23void autofs_kill_sb(struct super_block *sb)
24{ 24{
25 struct autofs_sb_info *sbi = autofs_sbi(sb); 25 struct autofs_sb_info *sbi = autofs_sbi(sb);
26 unsigned int n; 26 unsigned int n;
@@ -37,13 +37,13 @@ static void autofs_put_super(struct super_block *sb)
37 kfree(sb->s_fs_info); 37 kfree(sb->s_fs_info);
38 38
39 DPRINTK(("autofs: shutting down\n")); 39 DPRINTK(("autofs: shutting down\n"));
40 kill_anon_super(sb);
40} 41}
41 42
42static void autofs_read_inode(struct inode *inode); 43static void autofs_read_inode(struct inode *inode);
43 44
44static struct super_operations autofs_sops = { 45static struct super_operations autofs_sops = {
45 .read_inode = autofs_read_inode, 46 .read_inode = autofs_read_inode,
46 .put_super = autofs_put_super,
47 .statfs = simple_statfs, 47 .statfs = simple_statfs,
48}; 48};
49 49
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 7a11b8ae6644..5938a232d11b 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -104,10 +104,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
104 inode->i_op = &ecryptfs_dir_iops; 104 inode->i_op = &ecryptfs_dir_iops;
105 if (S_ISDIR(lower_inode->i_mode)) 105 if (S_ISDIR(lower_inode->i_mode))
106 inode->i_fop = &ecryptfs_dir_fops; 106 inode->i_fop = &ecryptfs_dir_fops;
107 /* TODO: Is there a better way to identify if the inode is 107 if (special_file(lower_inode->i_mode))
108 * special? */
109 if (S_ISBLK(lower_inode->i_mode) || S_ISCHR(lower_inode->i_mode) ||
110 S_ISFIFO(lower_inode->i_mode) || S_ISSOCK(lower_inode->i_mode))
111 init_special_inode(inode, lower_inode->i_mode, 108 init_special_inode(inode, lower_inode->i_mode,
112 lower_inode->i_rdev); 109 lower_inode->i_rdev);
113 dentry->d_op = &ecryptfs_dops; 110 dentry->d_op = &ecryptfs_dops;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index f4b8f8b3fbdd..8337451e7897 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -13,6 +13,7 @@
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
15#include <linux/writeback.h> 15#include <linux/writeback.h>
16#include <linux/backing-dev.h>
16#include <linux/blkdev.h> 17#include <linux/blkdev.h>
17 18
18int fat_generic_ioctl(struct inode *inode, struct file *filp, 19int fat_generic_ioctl(struct inode *inode, struct file *filp,
@@ -118,7 +119,7 @@ static int fat_file_release(struct inode *inode, struct file *filp)
118 if ((filp->f_mode & FMODE_WRITE) && 119 if ((filp->f_mode & FMODE_WRITE) &&
119 MSDOS_SB(inode->i_sb)->options.flush) { 120 MSDOS_SB(inode->i_sb)->options.flush) {
120 fat_flush_inodes(inode->i_sb, inode, NULL); 121 fat_flush_inodes(inode->i_sb, inode, NULL);
121 blk_congestion_wait(WRITE, HZ/10); 122 congestion_wait(WRITE, HZ/10);
122 } 123 }
123 return 0; 124 return 0;
124} 125}
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index e1b3c8af4d17..d5c63047a8b3 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -1314,13 +1314,14 @@ int journal_stop(handle_t *handle)
1314 int old_handle_count, err; 1314 int old_handle_count, err;
1315 pid_t pid; 1315 pid_t pid;
1316 1316
1317 J_ASSERT(transaction->t_updates > 0);
1318 J_ASSERT(journal_current_handle() == handle); 1317 J_ASSERT(journal_current_handle() == handle);
1319 1318
1320 if (is_handle_aborted(handle)) 1319 if (is_handle_aborted(handle))
1321 err = -EIO; 1320 err = -EIO;
1322 else 1321 else {
1322 J_ASSERT(transaction->t_updates > 0);
1323 err = 0; 1323 err = 0;
1324 }
1324 1325
1325 if (--handle->h_ref > 0) { 1326 if (--handle->h_ref > 0) {
1326 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, 1327 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 149957bef907..b6cf2be845a1 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1314,13 +1314,14 @@ int jbd2_journal_stop(handle_t *handle)
1314 int old_handle_count, err; 1314 int old_handle_count, err;
1315 pid_t pid; 1315 pid_t pid;
1316 1316
1317 J_ASSERT(transaction->t_updates > 0);
1318 J_ASSERT(journal_current_handle() == handle); 1317 J_ASSERT(journal_current_handle() == handle);
1319 1318
1320 if (is_handle_aborted(handle)) 1319 if (is_handle_aborted(handle))
1321 err = -EIO; 1320 err = -EIO;
1322 else 1321 else {
1322 J_ASSERT(transaction->t_updates > 0);
1323 err = 0; 1323 err = 0;
1324 }
1324 1325
1325 if (--handle->h_ref > 0) { 1326 if (--handle->h_ref > 0) {
1326 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, 1327 jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index e8c7765419e8..b85a0ad2cfb6 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -100,12 +100,12 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
100/* 100/*
101 * The server lockd has called us back to tell us the lock was granted 101 * The server lockd has called us back to tell us the lock was granted
102 */ 102 */
103u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock) 103__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock)
104{ 104{
105 const struct file_lock *fl = &lock->fl; 105 const struct file_lock *fl = &lock->fl;
106 const struct nfs_fh *fh = &lock->fh; 106 const struct nfs_fh *fh = &lock->fh;
107 struct nlm_wait *block; 107 struct nlm_wait *block;
108 u32 res = nlm_lck_denied; 108 __be32 res = nlm_lck_denied;
109 109
110 /* 110 /*
111 * Look up blocked request based on arguments. 111 * Look up blocked request based on arguments.
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index e0179f8c327f..eb243edf8932 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -148,8 +148,8 @@ nsm_create(void)
148 * XDR functions for NSM. 148 * XDR functions for NSM.
149 */ 149 */
150 150
151static u32 * 151static __be32 *
152xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 152xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
153{ 153{
154 char buffer[20], *name; 154 char buffer[20], *name;
155 155
@@ -176,7 +176,7 @@ xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
176} 176}
177 177
178static int 178static int
179xdr_encode_mon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 179xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
180{ 180{
181 p = xdr_encode_common(rqstp, p, argp); 181 p = xdr_encode_common(rqstp, p, argp);
182 if (IS_ERR(p)) 182 if (IS_ERR(p))
@@ -192,7 +192,7 @@ xdr_encode_mon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
192} 192}
193 193
194static int 194static int
195xdr_encode_unmon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 195xdr_encode_unmon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
196{ 196{
197 p = xdr_encode_common(rqstp, p, argp); 197 p = xdr_encode_common(rqstp, p, argp);
198 if (IS_ERR(p)) 198 if (IS_ERR(p))
@@ -202,7 +202,7 @@ xdr_encode_unmon(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
202} 202}
203 203
204static int 204static int
205xdr_decode_stat_res(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) 205xdr_decode_stat_res(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
206{ 206{
207 resp->status = ntohl(*p++); 207 resp->status = ntohl(*p++);
208 resp->state = ntohl(*p++); 208 resp->state = ntohl(*p++);
@@ -212,7 +212,7 @@ xdr_decode_stat_res(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp)
212} 212}
213 213
214static int 214static int
215xdr_decode_stat(struct rpc_rqst *rqstp, u32 *p, struct nsm_res *resp) 215xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
216{ 216{
217 resp->state = ntohl(*p++); 217 resp->state = ntohl(*p++);
218 return 0; 218 return 0;
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 399ad11b97be..0ce5c81ff507 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -24,14 +24,14 @@
24/* 24/*
25 * Obtain client and file from arguments 25 * Obtain client and file from arguments
26 */ 26 */
27static u32 27static __be32
28nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, 28nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
29 struct nlm_host **hostp, struct nlm_file **filp) 29 struct nlm_host **hostp, struct nlm_file **filp)
30{ 30{
31 struct nlm_host *host = NULL; 31 struct nlm_host *host = NULL;
32 struct nlm_file *file = NULL; 32 struct nlm_file *file = NULL;
33 struct nlm_lock *lock = &argp->lock; 33 struct nlm_lock *lock = &argp->lock;
34 u32 error = 0; 34 __be32 error = 0;
35 35
36 /* nfsd callbacks must have been installed for this procedure */ 36 /* nfsd callbacks must have been installed for this procedure */
37 if (!nlmsvc_ops) 37 if (!nlmsvc_ops)
@@ -68,7 +68,7 @@ no_locks:
68/* 68/*
69 * NULL: Test for presence of service 69 * NULL: Test for presence of service
70 */ 70 */
71static int 71static __be32
72nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 72nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
73{ 73{
74 dprintk("lockd: NULL called\n"); 74 dprintk("lockd: NULL called\n");
@@ -78,7 +78,7 @@ nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
78/* 78/*
79 * TEST: Check for conflicting lock 79 * TEST: Check for conflicting lock
80 */ 80 */
81static int 81static __be32
82nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 82nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
83 struct nlm_res *resp) 83 struct nlm_res *resp)
84{ 84{
@@ -107,7 +107,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
107 return rpc_success; 107 return rpc_success;
108} 108}
109 109
110static int 110static __be32
111nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 111nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
112 struct nlm_res *resp) 112 struct nlm_res *resp)
113{ 113{
@@ -150,7 +150,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
150 return rpc_success; 150 return rpc_success;
151} 151}
152 152
153static int 153static __be32
154nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 154nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
155 struct nlm_res *resp) 155 struct nlm_res *resp)
156{ 156{
@@ -183,7 +183,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
183/* 183/*
184 * UNLOCK: release a lock 184 * UNLOCK: release a lock
185 */ 185 */
186static int 186static __be32
187nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 187nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
188 struct nlm_res *resp) 188 struct nlm_res *resp)
189{ 189{
@@ -217,7 +217,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
217 * GRANTED: A server calls us to tell that a process' lock request 217 * GRANTED: A server calls us to tell that a process' lock request
218 * was granted 218 * was granted
219 */ 219 */
220static int 220static __be32
221nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 221nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
222 struct nlm_res *resp) 222 struct nlm_res *resp)
223{ 223{
@@ -253,12 +253,12 @@ static const struct rpc_call_ops nlm4svc_callback_ops = {
253 * because we send the callback before the reply proper. I hope this 253 * because we send the callback before the reply proper. I hope this
254 * doesn't break any clients. 254 * doesn't break any clients.
255 */ 255 */
256static int nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 256static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp,
257 int (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 257 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *))
258{ 258{
259 struct nlm_host *host; 259 struct nlm_host *host;
260 struct nlm_rqst *call; 260 struct nlm_rqst *call;
261 int stat; 261 __be32 stat;
262 262
263 host = nlmsvc_lookup_host(rqstp, 263 host = nlmsvc_lookup_host(rqstp,
264 argp->lock.caller, 264 argp->lock.caller,
@@ -282,35 +282,35 @@ static int nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *a
282 return rpc_success; 282 return rpc_success;
283} 283}
284 284
285static int nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 285static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
286 void *resp) 286 void *resp)
287{ 287{
288 dprintk("lockd: TEST_MSG called\n"); 288 dprintk("lockd: TEST_MSG called\n");
289 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test); 289 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test);
290} 290}
291 291
292static int nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 292static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
293 void *resp) 293 void *resp)
294{ 294{
295 dprintk("lockd: LOCK_MSG called\n"); 295 dprintk("lockd: LOCK_MSG called\n");
296 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock); 296 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock);
297} 297}
298 298
299static int nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 299static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
300 void *resp) 300 void *resp)
301{ 301{
302 dprintk("lockd: CANCEL_MSG called\n"); 302 dprintk("lockd: CANCEL_MSG called\n");
303 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel); 303 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel);
304} 304}
305 305
306static int nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 306static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
307 void *resp) 307 void *resp)
308{ 308{
309 dprintk("lockd: UNLOCK_MSG called\n"); 309 dprintk("lockd: UNLOCK_MSG called\n");
310 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock); 310 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock);
311} 311}
312 312
313static int nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 313static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
314 void *resp) 314 void *resp)
315{ 315{
316 dprintk("lockd: GRANTED_MSG called\n"); 316 dprintk("lockd: GRANTED_MSG called\n");
@@ -320,7 +320,7 @@ static int nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *arg
320/* 320/*
321 * SHARE: create a DOS share or alter existing share. 321 * SHARE: create a DOS share or alter existing share.
322 */ 322 */
323static int 323static __be32
324nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 324nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
325 struct nlm_res *resp) 325 struct nlm_res *resp)
326{ 326{
@@ -353,7 +353,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
353/* 353/*
354 * UNSHARE: Release a DOS share. 354 * UNSHARE: Release a DOS share.
355 */ 355 */
356static int 356static __be32
357nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 357nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
358 struct nlm_res *resp) 358 struct nlm_res *resp)
359{ 359{
@@ -386,7 +386,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
386/* 386/*
387 * NM_LOCK: Create an unmonitored lock 387 * NM_LOCK: Create an unmonitored lock
388 */ 388 */
389static int 389static __be32
390nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 390nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
391 struct nlm_res *resp) 391 struct nlm_res *resp)
392{ 392{
@@ -399,7 +399,7 @@ nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
399/* 399/*
400 * FREE_ALL: Release all locks and shares held by client 400 * FREE_ALL: Release all locks and shares held by client
401 */ 401 */
402static int 402static __be32
403nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 403nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
404 void *resp) 404 void *resp)
405{ 405{
@@ -417,7 +417,7 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
417/* 417/*
418 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 418 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
419 */ 419 */
420static int 420static __be32
421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
422 void *resp) 422 void *resp)
423{ 423{
@@ -446,7 +446,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
446/* 446/*
447 * client sent a GRANTED_RES, let's remove the associated block 447 * client sent a GRANTED_RES, let's remove the associated block
448 */ 448 */
449static int 449static __be32
450nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 450nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
451 void *resp) 451 void *resp)
452{ 452{
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 814c6064c9e0..7e219b938552 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -334,13 +334,13 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
334 * Attempt to establish a lock, and if it can't be granted, block it 334 * Attempt to establish a lock, and if it can't be granted, block it
335 * if required. 335 * if required.
336 */ 336 */
337u32 337__be32
338nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, 338nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
339 struct nlm_lock *lock, int wait, struct nlm_cookie *cookie) 339 struct nlm_lock *lock, int wait, struct nlm_cookie *cookie)
340{ 340{
341 struct nlm_block *block, *newblock = NULL; 341 struct nlm_block *block, *newblock = NULL;
342 int error; 342 int error;
343 u32 ret; 343 __be32 ret;
344 344
345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", 345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
346 file->f_file->f_dentry->d_inode->i_sb->s_id, 346 file->f_file->f_dentry->d_inode->i_sb->s_id,
@@ -415,7 +415,7 @@ out:
415/* 415/*
416 * Test for presence of a conflicting lock. 416 * Test for presence of a conflicting lock.
417 */ 417 */
418u32 418__be32
419nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock, 419nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
420 struct nlm_lock *conflock) 420 struct nlm_lock *conflock)
421{ 421{
@@ -448,7 +448,7 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
448 * afterwards. In this case the block will still be there, and hence 448 * afterwards. In this case the block will still be there, and hence
449 * must be removed. 449 * must be removed.
450 */ 450 */
451u32 451__be32
452nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock) 452nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
453{ 453{
454 int error; 454 int error;
@@ -476,7 +476,7 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
476 * be in progress. 476 * be in progress.
477 * The calling procedure must check whether the file can be closed. 477 * The calling procedure must check whether the file can be closed.
478 */ 478 */
479u32 479__be32
480nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) 480nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
481{ 481{
482 struct nlm_block *block; 482 struct nlm_block *block;
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 6a931f4ab75c..32e99a6e8dca 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -22,8 +22,8 @@
22#define NLMDBG_FACILITY NLMDBG_CLIENT 22#define NLMDBG_FACILITY NLMDBG_CLIENT
23 23
24#ifdef CONFIG_LOCKD_V4 24#ifdef CONFIG_LOCKD_V4
25static u32 25static __be32
26cast_to_nlm(u32 status, u32 vers) 26cast_to_nlm(__be32 status, u32 vers)
27{ 27{
28 /* Note: status is assumed to be in network byte order !!! */ 28 /* Note: status is assumed to be in network byte order !!! */
29 if (vers != 4){ 29 if (vers != 4){
@@ -52,14 +52,14 @@ cast_to_nlm(u32 status, u32 vers)
52/* 52/*
53 * Obtain client and file from arguments 53 * Obtain client and file from arguments
54 */ 54 */
55static u32 55static __be32
56nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, 56nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
57 struct nlm_host **hostp, struct nlm_file **filp) 57 struct nlm_host **hostp, struct nlm_file **filp)
58{ 58{
59 struct nlm_host *host = NULL; 59 struct nlm_host *host = NULL;
60 struct nlm_file *file = NULL; 60 struct nlm_file *file = NULL;
61 struct nlm_lock *lock = &argp->lock; 61 struct nlm_lock *lock = &argp->lock;
62 u32 error = 0; 62 __be32 error = 0;
63 63
64 /* nfsd callbacks must have been installed for this procedure */ 64 /* nfsd callbacks must have been installed for this procedure */
65 if (!nlmsvc_ops) 65 if (!nlmsvc_ops)
@@ -96,7 +96,7 @@ no_locks:
96/* 96/*
97 * NULL: Test for presence of service 97 * NULL: Test for presence of service
98 */ 98 */
99static int 99static __be32
100nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 100nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
101{ 101{
102 dprintk("lockd: NULL called\n"); 102 dprintk("lockd: NULL called\n");
@@ -106,7 +106,7 @@ nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
106/* 106/*
107 * TEST: Check for conflicting lock 107 * TEST: Check for conflicting lock
108 */ 108 */
109static int 109static __be32
110nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 110nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
111 struct nlm_res *resp) 111 struct nlm_res *resp)
112{ 112{
@@ -136,7 +136,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
136 return rpc_success; 136 return rpc_success;
137} 137}
138 138
139static int 139static __be32
140nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 140nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
141 struct nlm_res *resp) 141 struct nlm_res *resp)
142{ 142{
@@ -179,7 +179,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
179 return rpc_success; 179 return rpc_success;
180} 180}
181 181
182static int 182static __be32
183nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 183nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
184 struct nlm_res *resp) 184 struct nlm_res *resp)
185{ 185{
@@ -212,7 +212,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
212/* 212/*
213 * UNLOCK: release a lock 213 * UNLOCK: release a lock
214 */ 214 */
215static int 215static __be32
216nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 216nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
217 struct nlm_res *resp) 217 struct nlm_res *resp)
218{ 218{
@@ -246,7 +246,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
246 * GRANTED: A server calls us to tell that a process' lock request 246 * GRANTED: A server calls us to tell that a process' lock request
247 * was granted 247 * was granted
248 */ 248 */
249static int 249static __be32
250nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 250nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
251 struct nlm_res *resp) 251 struct nlm_res *resp)
252{ 252{
@@ -282,12 +282,12 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
282 * because we send the callback before the reply proper. I hope this 282 * because we send the callback before the reply proper. I hope this
283 * doesn't break any clients. 283 * doesn't break any clients.
284 */ 284 */
285static int nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 285static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp,
286 int (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 286 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *))
287{ 287{
288 struct nlm_host *host; 288 struct nlm_host *host;
289 struct nlm_rqst *call; 289 struct nlm_rqst *call;
290 int stat; 290 __be32 stat;
291 291
292 host = nlmsvc_lookup_host(rqstp, 292 host = nlmsvc_lookup_host(rqstp,
293 argp->lock.caller, 293 argp->lock.caller,
@@ -311,28 +311,28 @@ static int nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *ar
311 return rpc_success; 311 return rpc_success;
312} 312}
313 313
314static int nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 314static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
315 void *resp) 315 void *resp)
316{ 316{
317 dprintk("lockd: TEST_MSG called\n"); 317 dprintk("lockd: TEST_MSG called\n");
318 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test); 318 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test);
319} 319}
320 320
321static int nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 321static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
322 void *resp) 322 void *resp)
323{ 323{
324 dprintk("lockd: LOCK_MSG called\n"); 324 dprintk("lockd: LOCK_MSG called\n");
325 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock); 325 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock);
326} 326}
327 327
328static int nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 328static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
329 void *resp) 329 void *resp)
330{ 330{
331 dprintk("lockd: CANCEL_MSG called\n"); 331 dprintk("lockd: CANCEL_MSG called\n");
332 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel); 332 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel);
333} 333}
334 334
335static int 335static __be32
336nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 336nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
337 void *resp) 337 void *resp)
338{ 338{
@@ -340,7 +340,7 @@ nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
340 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock); 340 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock);
341} 341}
342 342
343static int 343static __be32
344nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 344nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
345 void *resp) 345 void *resp)
346{ 346{
@@ -351,7 +351,7 @@ nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
351/* 351/*
352 * SHARE: create a DOS share or alter existing share. 352 * SHARE: create a DOS share or alter existing share.
353 */ 353 */
354static int 354static __be32
355nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 355nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
356 struct nlm_res *resp) 356 struct nlm_res *resp)
357{ 357{
@@ -384,7 +384,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
384/* 384/*
385 * UNSHARE: Release a DOS share. 385 * UNSHARE: Release a DOS share.
386 */ 386 */
387static int 387static __be32
388nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 388nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
389 struct nlm_res *resp) 389 struct nlm_res *resp)
390{ 390{
@@ -417,7 +417,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
417/* 417/*
418 * NM_LOCK: Create an unmonitored lock 418 * NM_LOCK: Create an unmonitored lock
419 */ 419 */
420static int 420static __be32
421nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 421nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
422 struct nlm_res *resp) 422 struct nlm_res *resp)
423{ 423{
@@ -430,7 +430,7 @@ nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
430/* 430/*
431 * FREE_ALL: Release all locks and shares held by client 431 * FREE_ALL: Release all locks and shares held by client
432 */ 432 */
433static int 433static __be32
434nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 434nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
435 void *resp) 435 void *resp)
436{ 436{
@@ -448,7 +448,7 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
448/* 448/*
449 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 449 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
450 */ 450 */
451static int 451static __be32
452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
453 void *resp) 453 void *resp)
454{ 454{
@@ -477,7 +477,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
477/* 477/*
478 * client sent a GRANTED_RES, let's remove the associated block 478 * client sent a GRANTED_RES, let's remove the associated block
479 */ 479 */
480static int 480static __be32
481nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 481nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
482 void *resp) 482 void *resp)
483{ 483{
diff --git a/fs/lockd/svcshare.c b/fs/lockd/svcshare.c
index b9926ce8782e..6220dc2a3f2c 100644
--- a/fs/lockd/svcshare.c
+++ b/fs/lockd/svcshare.c
@@ -23,7 +23,7 @@ nlm_cmp_owner(struct nlm_share *share, struct xdr_netobj *oh)
23 && !memcmp(share->s_owner.data, oh->data, oh->len); 23 && !memcmp(share->s_owner.data, oh->data, oh->len);
24} 24}
25 25
26u32 26__be32
27nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file, 27nlmsvc_share_file(struct nlm_host *host, struct nlm_file *file,
28 struct nlm_args *argp) 28 struct nlm_args *argp)
29{ 29{
@@ -64,7 +64,7 @@ update:
64/* 64/*
65 * Delete a share. 65 * Delete a share.
66 */ 66 */
67u32 67__be32
68nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file, 68nlmsvc_unshare_file(struct nlm_host *host, struct nlm_file *file,
69 struct nlm_args *argp) 69 struct nlm_args *argp)
70{ 70{
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 7dac96e6c82c..e83024e16042 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -78,14 +78,14 @@ static inline unsigned int file_hash(struct nfs_fh *f)
78 * This is not quite right, but for now, we assume the client performs 78 * This is not quite right, but for now, we assume the client performs
79 * the proper R/W checking. 79 * the proper R/W checking.
80 */ 80 */
81u32 81__be32
82nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, 82nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
83 struct nfs_fh *f) 83 struct nfs_fh *f)
84{ 84{
85 struct hlist_node *pos; 85 struct hlist_node *pos;
86 struct nlm_file *file; 86 struct nlm_file *file;
87 unsigned int hash; 87 unsigned int hash;
88 u32 nfserr; 88 __be32 nfserr;
89 89
90 nlm_debug_print_fh("nlm_file_lookup", f); 90 nlm_debug_print_fh("nlm_file_lookup", f);
91 91
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 61c46facf257..b7c949256e5a 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -43,7 +43,7 @@ loff_t_to_s32(loff_t offset)
43/* 43/*
44 * XDR functions for basic NLM types 44 * XDR functions for basic NLM types
45 */ 45 */
46static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) 46static __be32 *nlm_decode_cookie(__be32 *p, struct nlm_cookie *c)
47{ 47{
48 unsigned int len; 48 unsigned int len;
49 49
@@ -69,8 +69,8 @@ static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c)
69 return p; 69 return p;
70} 70}
71 71
72static inline u32 * 72static inline __be32 *
73nlm_encode_cookie(u32 *p, struct nlm_cookie *c) 73nlm_encode_cookie(__be32 *p, struct nlm_cookie *c)
74{ 74{
75 *p++ = htonl(c->len); 75 *p++ = htonl(c->len);
76 memcpy(p, c->data, c->len); 76 memcpy(p, c->data, c->len);
@@ -78,8 +78,8 @@ nlm_encode_cookie(u32 *p, struct nlm_cookie *c)
78 return p; 78 return p;
79} 79}
80 80
81static u32 * 81static __be32 *
82nlm_decode_fh(u32 *p, struct nfs_fh *f) 82nlm_decode_fh(__be32 *p, struct nfs_fh *f)
83{ 83{
84 unsigned int len; 84 unsigned int len;
85 85
@@ -95,8 +95,8 @@ nlm_decode_fh(u32 *p, struct nfs_fh *f)
95 return p + XDR_QUADLEN(NFS2_FHSIZE); 95 return p + XDR_QUADLEN(NFS2_FHSIZE);
96} 96}
97 97
98static inline u32 * 98static inline __be32 *
99nlm_encode_fh(u32 *p, struct nfs_fh *f) 99nlm_encode_fh(__be32 *p, struct nfs_fh *f)
100{ 100{
101 *p++ = htonl(NFS2_FHSIZE); 101 *p++ = htonl(NFS2_FHSIZE);
102 memcpy(p, f->data, NFS2_FHSIZE); 102 memcpy(p, f->data, NFS2_FHSIZE);
@@ -106,20 +106,20 @@ nlm_encode_fh(u32 *p, struct nfs_fh *f)
106/* 106/*
107 * Encode and decode owner handle 107 * Encode and decode owner handle
108 */ 108 */
109static inline u32 * 109static inline __be32 *
110nlm_decode_oh(u32 *p, struct xdr_netobj *oh) 110nlm_decode_oh(__be32 *p, struct xdr_netobj *oh)
111{ 111{
112 return xdr_decode_netobj(p, oh); 112 return xdr_decode_netobj(p, oh);
113} 113}
114 114
115static inline u32 * 115static inline __be32 *
116nlm_encode_oh(u32 *p, struct xdr_netobj *oh) 116nlm_encode_oh(__be32 *p, struct xdr_netobj *oh)
117{ 117{
118 return xdr_encode_netobj(p, oh); 118 return xdr_encode_netobj(p, oh);
119} 119}
120 120
121static u32 * 121static __be32 *
122nlm_decode_lock(u32 *p, struct nlm_lock *lock) 122nlm_decode_lock(__be32 *p, struct nlm_lock *lock)
123{ 123{
124 struct file_lock *fl = &lock->fl; 124 struct file_lock *fl = &lock->fl;
125 s32 start, len, end; 125 s32 start, len, end;
@@ -153,8 +153,8 @@ nlm_decode_lock(u32 *p, struct nlm_lock *lock)
153/* 153/*
154 * Encode a lock as part of an NLM call 154 * Encode a lock as part of an NLM call
155 */ 155 */
156static u32 * 156static __be32 *
157nlm_encode_lock(u32 *p, struct nlm_lock *lock) 157nlm_encode_lock(__be32 *p, struct nlm_lock *lock)
158{ 158{
159 struct file_lock *fl = &lock->fl; 159 struct file_lock *fl = &lock->fl;
160 __s32 start, len; 160 __s32 start, len;
@@ -184,8 +184,8 @@ nlm_encode_lock(u32 *p, struct nlm_lock *lock)
184/* 184/*
185 * Encode result of a TEST/TEST_MSG call 185 * Encode result of a TEST/TEST_MSG call
186 */ 186 */
187static u32 * 187static __be32 *
188nlm_encode_testres(u32 *p, struct nlm_res *resp) 188nlm_encode_testres(__be32 *p, struct nlm_res *resp)
189{ 189{
190 s32 start, len; 190 s32 start, len;
191 191
@@ -221,7 +221,7 @@ nlm_encode_testres(u32 *p, struct nlm_res *resp)
221 * First, the server side XDR functions 221 * First, the server side XDR functions
222 */ 222 */
223int 223int
224nlmsvc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 224nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
225{ 225{
226 u32 exclusive; 226 u32 exclusive;
227 227
@@ -238,7 +238,7 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
238} 238}
239 239
240int 240int
241nlmsvc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 241nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
242{ 242{
243 if (!(p = nlm_encode_testres(p, resp))) 243 if (!(p = nlm_encode_testres(p, resp)))
244 return 0; 244 return 0;
@@ -246,7 +246,7 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
246} 246}
247 247
248int 248int
249nlmsvc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 249nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
250{ 250{
251 u32 exclusive; 251 u32 exclusive;
252 252
@@ -266,7 +266,7 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
266} 266}
267 267
268int 268int
269nlmsvc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 269nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
270{ 270{
271 u32 exclusive; 271 u32 exclusive;
272 272
@@ -282,7 +282,7 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
282} 282}
283 283
284int 284int
285nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 285nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
286{ 286{
287 if (!(p = nlm_decode_cookie(p, &argp->cookie)) 287 if (!(p = nlm_decode_cookie(p, &argp->cookie))
288 || !(p = nlm_decode_lock(p, &argp->lock))) 288 || !(p = nlm_decode_lock(p, &argp->lock)))
@@ -292,7 +292,7 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
292} 292}
293 293
294int 294int
295nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 295nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
296{ 296{
297 struct nlm_lock *lock = &argp->lock; 297 struct nlm_lock *lock = &argp->lock;
298 298
@@ -313,7 +313,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
313} 313}
314 314
315int 315int
316nlmsvc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 316nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
317{ 317{
318 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 318 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
319 return 0; 319 return 0;
@@ -323,7 +323,7 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
323} 323}
324 324
325int 325int
326nlmsvc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 326nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
327{ 327{
328 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 328 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
329 return 0; 329 return 0;
@@ -332,7 +332,7 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
332} 332}
333 333
334int 334int
335nlmsvc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp) 335nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
336{ 336{
337 struct nlm_lock *lock = &argp->lock; 337 struct nlm_lock *lock = &argp->lock;
338 338
@@ -344,7 +344,7 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
344} 344}
345 345
346int 346int
347nlmsvc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp) 347nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
348{ 348{
349 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 349 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
350 return 0; 350 return 0;
@@ -357,7 +357,7 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
357} 357}
358 358
359int 359int
360nlmsvc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 360nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
361{ 361{
362 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 362 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
363 return 0; 363 return 0;
@@ -366,13 +366,13 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
366} 366}
367 367
368int 368int
369nlmsvc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 369nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
370{ 370{
371 return xdr_argsize_check(rqstp, p); 371 return xdr_argsize_check(rqstp, p);
372} 372}
373 373
374int 374int
375nlmsvc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 375nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
376{ 376{
377 return xdr_ressize_check(rqstp, p); 377 return xdr_ressize_check(rqstp, p);
378} 378}
@@ -389,7 +389,7 @@ nlmclt_decode_void(struct rpc_rqst *req, u32 *p, void *ptr)
389#endif 389#endif
390 390
391static int 391static int
392nlmclt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 392nlmclt_encode_testargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
393{ 393{
394 struct nlm_lock *lock = &argp->lock; 394 struct nlm_lock *lock = &argp->lock;
395 395
@@ -403,7 +403,7 @@ nlmclt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
403} 403}
404 404
405static int 405static int
406nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 406nlmclt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
407{ 407{
408 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 408 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
409 return -EIO; 409 return -EIO;
@@ -438,7 +438,7 @@ nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
438 438
439 439
440static int 440static int
441nlmclt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 441nlmclt_encode_lockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
442{ 442{
443 struct nlm_lock *lock = &argp->lock; 443 struct nlm_lock *lock = &argp->lock;
444 444
@@ -455,7 +455,7 @@ nlmclt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
455} 455}
456 456
457static int 457static int
458nlmclt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 458nlmclt_encode_cancargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
459{ 459{
460 struct nlm_lock *lock = &argp->lock; 460 struct nlm_lock *lock = &argp->lock;
461 461
@@ -470,7 +470,7 @@ nlmclt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
470} 470}
471 471
472static int 472static int
473nlmclt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 473nlmclt_encode_unlockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
474{ 474{
475 struct nlm_lock *lock = &argp->lock; 475 struct nlm_lock *lock = &argp->lock;
476 476
@@ -483,7 +483,7 @@ nlmclt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
483} 483}
484 484
485static int 485static int
486nlmclt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 486nlmclt_encode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
487{ 487{
488 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 488 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
489 return -EIO; 489 return -EIO;
@@ -493,7 +493,7 @@ nlmclt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
493} 493}
494 494
495static int 495static int
496nlmclt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 496nlmclt_encode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
497{ 497{
498 if (!(p = nlm_encode_testres(p, resp))) 498 if (!(p = nlm_encode_testres(p, resp)))
499 return -EIO; 499 return -EIO;
@@ -502,7 +502,7 @@ nlmclt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
502} 502}
503 503
504static int 504static int
505nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 505nlmclt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
506{ 506{
507 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 507 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
508 return -EIO; 508 return -EIO;
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 36eb175ec335..f4c0b2b9f75a 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -44,8 +44,8 @@ loff_t_to_s64(loff_t offset)
44/* 44/*
45 * XDR functions for basic NLM types 45 * XDR functions for basic NLM types
46 */ 46 */
47static u32 * 47static __be32 *
48nlm4_decode_cookie(u32 *p, struct nlm_cookie *c) 48nlm4_decode_cookie(__be32 *p, struct nlm_cookie *c)
49{ 49{
50 unsigned int len; 50 unsigned int len;
51 51
@@ -71,8 +71,8 @@ nlm4_decode_cookie(u32 *p, struct nlm_cookie *c)
71 return p; 71 return p;
72} 72}
73 73
74static u32 * 74static __be32 *
75nlm4_encode_cookie(u32 *p, struct nlm_cookie *c) 75nlm4_encode_cookie(__be32 *p, struct nlm_cookie *c)
76{ 76{
77 *p++ = htonl(c->len); 77 *p++ = htonl(c->len);
78 memcpy(p, c->data, c->len); 78 memcpy(p, c->data, c->len);
@@ -80,8 +80,8 @@ nlm4_encode_cookie(u32 *p, struct nlm_cookie *c)
80 return p; 80 return p;
81} 81}
82 82
83static u32 * 83static __be32 *
84nlm4_decode_fh(u32 *p, struct nfs_fh *f) 84nlm4_decode_fh(__be32 *p, struct nfs_fh *f)
85{ 85{
86 memset(f->data, 0, sizeof(f->data)); 86 memset(f->data, 0, sizeof(f->data));
87 f->size = ntohl(*p++); 87 f->size = ntohl(*p++);
@@ -95,8 +95,8 @@ nlm4_decode_fh(u32 *p, struct nfs_fh *f)
95 return p + XDR_QUADLEN(f->size); 95 return p + XDR_QUADLEN(f->size);
96} 96}
97 97
98static u32 * 98static __be32 *
99nlm4_encode_fh(u32 *p, struct nfs_fh *f) 99nlm4_encode_fh(__be32 *p, struct nfs_fh *f)
100{ 100{
101 *p++ = htonl(f->size); 101 *p++ = htonl(f->size);
102 if (f->size) p[XDR_QUADLEN(f->size)-1] = 0; /* don't leak anything */ 102 if (f->size) p[XDR_QUADLEN(f->size)-1] = 0; /* don't leak anything */
@@ -107,20 +107,20 @@ nlm4_encode_fh(u32 *p, struct nfs_fh *f)
107/* 107/*
108 * Encode and decode owner handle 108 * Encode and decode owner handle
109 */ 109 */
110static u32 * 110static __be32 *
111nlm4_decode_oh(u32 *p, struct xdr_netobj *oh) 111nlm4_decode_oh(__be32 *p, struct xdr_netobj *oh)
112{ 112{
113 return xdr_decode_netobj(p, oh); 113 return xdr_decode_netobj(p, oh);
114} 114}
115 115
116static u32 * 116static __be32 *
117nlm4_encode_oh(u32 *p, struct xdr_netobj *oh) 117nlm4_encode_oh(__be32 *p, struct xdr_netobj *oh)
118{ 118{
119 return xdr_encode_netobj(p, oh); 119 return xdr_encode_netobj(p, oh);
120} 120}
121 121
122static u32 * 122static __be32 *
123nlm4_decode_lock(u32 *p, struct nlm_lock *lock) 123nlm4_decode_lock(__be32 *p, struct nlm_lock *lock)
124{ 124{
125 struct file_lock *fl = &lock->fl; 125 struct file_lock *fl = &lock->fl;
126 __s64 len, start, end; 126 __s64 len, start, end;
@@ -153,8 +153,8 @@ nlm4_decode_lock(u32 *p, struct nlm_lock *lock)
153/* 153/*
154 * Encode a lock as part of an NLM call 154 * Encode a lock as part of an NLM call
155 */ 155 */
156static u32 * 156static __be32 *
157nlm4_encode_lock(u32 *p, struct nlm_lock *lock) 157nlm4_encode_lock(__be32 *p, struct nlm_lock *lock)
158{ 158{
159 struct file_lock *fl = &lock->fl; 159 struct file_lock *fl = &lock->fl;
160 __s64 start, len; 160 __s64 start, len;
@@ -185,8 +185,8 @@ nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
185/* 185/*
186 * Encode result of a TEST/TEST_MSG call 186 * Encode result of a TEST/TEST_MSG call
187 */ 187 */
188static u32 * 188static __be32 *
189nlm4_encode_testres(u32 *p, struct nlm_res *resp) 189nlm4_encode_testres(__be32 *p, struct nlm_res *resp)
190{ 190{
191 s64 start, len; 191 s64 start, len;
192 192
@@ -227,7 +227,7 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
227 * First, the server side XDR functions 227 * First, the server side XDR functions
228 */ 228 */
229int 229int
230nlm4svc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 230nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
231{ 231{
232 u32 exclusive; 232 u32 exclusive;
233 233
@@ -244,7 +244,7 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
244} 244}
245 245
246int 246int
247nlm4svc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 247nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
248{ 248{
249 if (!(p = nlm4_encode_testres(p, resp))) 249 if (!(p = nlm4_encode_testres(p, resp)))
250 return 0; 250 return 0;
@@ -252,7 +252,7 @@ nlm4svc_encode_testres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
252} 252}
253 253
254int 254int
255nlm4svc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 255nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
256{ 256{
257 u32 exclusive; 257 u32 exclusive;
258 258
@@ -272,7 +272,7 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
272} 272}
273 273
274int 274int
275nlm4svc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 275nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
276{ 276{
277 u32 exclusive; 277 u32 exclusive;
278 278
@@ -288,7 +288,7 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
288} 288}
289 289
290int 290int
291nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 291nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
292{ 292{
293 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 293 if (!(p = nlm4_decode_cookie(p, &argp->cookie))
294 || !(p = nlm4_decode_lock(p, &argp->lock))) 294 || !(p = nlm4_decode_lock(p, &argp->lock)))
@@ -298,7 +298,7 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
298} 298}
299 299
300int 300int
301nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) 301nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
302{ 302{
303 struct nlm_lock *lock = &argp->lock; 303 struct nlm_lock *lock = &argp->lock;
304 304
@@ -319,7 +319,7 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
319} 319}
320 320
321int 321int
322nlm4svc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 322nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
323{ 323{
324 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 324 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
325 return 0; 325 return 0;
@@ -329,7 +329,7 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
329} 329}
330 330
331int 331int
332nlm4svc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 332nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
333{ 333{
334 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 334 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
335 return 0; 335 return 0;
@@ -338,7 +338,7 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
338} 338}
339 339
340int 340int
341nlm4svc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp) 341nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
342{ 342{
343 struct nlm_lock *lock = &argp->lock; 343 struct nlm_lock *lock = &argp->lock;
344 344
@@ -350,7 +350,7 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
350} 350}
351 351
352int 352int
353nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp) 353nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
354{ 354{
355 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 355 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
356 return 0; 356 return 0;
@@ -363,7 +363,7 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
363} 363}
364 364
365int 365int
366nlm4svc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp) 366nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
367{ 367{
368 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 368 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
369 return 0; 369 return 0;
@@ -372,13 +372,13 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, u32 *p, struct nlm_res *resp)
372} 372}
373 373
374int 374int
375nlm4svc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 375nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
376{ 376{
377 return xdr_argsize_check(rqstp, p); 377 return xdr_argsize_check(rqstp, p);
378} 378}
379 379
380int 380int
381nlm4svc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 381nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
382{ 382{
383 return xdr_ressize_check(rqstp, p); 383 return xdr_ressize_check(rqstp, p);
384} 384}
@@ -388,14 +388,14 @@ nlm4svc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy)
388 */ 388 */
389#ifdef NLMCLNT_SUPPORT_SHARES 389#ifdef NLMCLNT_SUPPORT_SHARES
390static int 390static int
391nlm4clt_decode_void(struct rpc_rqst *req, u32 *p, void *ptr) 391nlm4clt_decode_void(struct rpc_rqst *req, __be32 *p, void *ptr)
392{ 392{
393 return 0; 393 return 0;
394} 394}
395#endif 395#endif
396 396
397static int 397static int
398nlm4clt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 398nlm4clt_encode_testargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
399{ 399{
400 struct nlm_lock *lock = &argp->lock; 400 struct nlm_lock *lock = &argp->lock;
401 401
@@ -409,7 +409,7 @@ nlm4clt_encode_testargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
409} 409}
410 410
411static int 411static int
412nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 412nlm4clt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
413{ 413{
414 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 414 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
415 return -EIO; 415 return -EIO;
@@ -444,7 +444,7 @@ nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
444 444
445 445
446static int 446static int
447nlm4clt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 447nlm4clt_encode_lockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
448{ 448{
449 struct nlm_lock *lock = &argp->lock; 449 struct nlm_lock *lock = &argp->lock;
450 450
@@ -461,7 +461,7 @@ nlm4clt_encode_lockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
461} 461}
462 462
463static int 463static int
464nlm4clt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 464nlm4clt_encode_cancargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
465{ 465{
466 struct nlm_lock *lock = &argp->lock; 466 struct nlm_lock *lock = &argp->lock;
467 467
@@ -476,7 +476,7 @@ nlm4clt_encode_cancargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
476} 476}
477 477
478static int 478static int
479nlm4clt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp) 479nlm4clt_encode_unlockargs(struct rpc_rqst *req, __be32 *p, nlm_args *argp)
480{ 480{
481 struct nlm_lock *lock = &argp->lock; 481 struct nlm_lock *lock = &argp->lock;
482 482
@@ -489,7 +489,7 @@ nlm4clt_encode_unlockargs(struct rpc_rqst *req, u32 *p, nlm_args *argp)
489} 489}
490 490
491static int 491static int
492nlm4clt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 492nlm4clt_encode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
493{ 493{
494 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 494 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
495 return -EIO; 495 return -EIO;
@@ -499,7 +499,7 @@ nlm4clt_encode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
499} 499}
500 500
501static int 501static int
502nlm4clt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 502nlm4clt_encode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
503{ 503{
504 if (!(p = nlm4_encode_testres(p, resp))) 504 if (!(p = nlm4_encode_testres(p, resp)))
505 return -EIO; 505 return -EIO;
@@ -508,7 +508,7 @@ nlm4clt_encode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
508} 508}
509 509
510static int 510static int
511nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) 511nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
512{ 512{
513 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 513 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
514 return -EIO; 514 return -EIO;
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index 5676163d26e8..db3d7919c601 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -31,10 +31,10 @@ struct cb_compound_hdr_arg {
31}; 31};
32 32
33struct cb_compound_hdr_res { 33struct cb_compound_hdr_res {
34 uint32_t *status; 34 __be32 *status;
35 int taglen; 35 int taglen;
36 const char *tag; 36 const char *tag;
37 uint32_t *nops; 37 __be32 *nops;
38}; 38};
39 39
40struct cb_getattrargs { 40struct cb_getattrargs {
@@ -44,7 +44,7 @@ struct cb_getattrargs {
44}; 44};
45 45
46struct cb_getattrres { 46struct cb_getattrres {
47 uint32_t status; 47 __be32 status;
48 uint32_t bitmap[2]; 48 uint32_t bitmap[2];
49 uint64_t size; 49 uint64_t size;
50 uint64_t change_attr; 50 uint64_t change_attr;
@@ -59,8 +59,8 @@ struct cb_recallargs {
59 uint32_t truncate; 59 uint32_t truncate;
60}; 60};
61 61
62extern unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res); 62extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
63extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy); 63extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
64 64
65#ifdef CONFIG_NFS_V4 65#ifdef CONFIG_NFS_V4
66extern int nfs_callback_up(void); 66extern int nfs_callback_up(void);
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 97cf8f71451f..72e55d83756d 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -14,7 +14,7 @@
14 14
15#define NFSDBG_FACILITY NFSDBG_CALLBACK 15#define NFSDBG_FACILITY NFSDBG_CALLBACK
16 16
17unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) 17__be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res)
18{ 18{
19 struct nfs_client *clp; 19 struct nfs_client *clp;
20 struct nfs_delegation *delegation; 20 struct nfs_delegation *delegation;
@@ -55,11 +55,11 @@ out:
55 return res->status; 55 return res->status;
56} 56}
57 57
58unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy) 58__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
59{ 59{
60 struct nfs_client *clp; 60 struct nfs_client *clp;
61 struct inode *inode; 61 struct inode *inode;
62 unsigned res; 62 __be32 res;
63 63
64 res = htonl(NFS4ERR_BADHANDLE); 64 res = htonl(NFS4ERR_BADHANDLE);
65 clp = nfs_find_client(args->addr, 4); 65 clp = nfs_find_client(args->addr, 4);
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 29f932192054..f8ea1f51f590 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -22,9 +22,9 @@
22 22
23#define NFSDBG_FACILITY NFSDBG_CALLBACK 23#define NFSDBG_FACILITY NFSDBG_CALLBACK
24 24
25typedef unsigned (*callback_process_op_t)(void *, void *); 25typedef __be32 (*callback_process_op_t)(void *, void *);
26typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); 26typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
27typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); 27typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
28 28
29 29
30struct callback_op { 30struct callback_op {
@@ -36,24 +36,24 @@ struct callback_op {
36 36
37static struct callback_op callback_ops[]; 37static struct callback_op callback_ops[];
38 38
39static int nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) 39static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp)
40{ 40{
41 return htonl(NFS4_OK); 41 return htonl(NFS4_OK);
42} 42}
43 43
44static int nfs4_decode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) 44static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
45{ 45{
46 return xdr_argsize_check(rqstp, p); 46 return xdr_argsize_check(rqstp, p);
47} 47}
48 48
49static int nfs4_encode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) 49static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
50{ 50{
51 return xdr_ressize_check(rqstp, p); 51 return xdr_ressize_check(rqstp, p);
52} 52}
53 53
54static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) 54static __be32 *read_buf(struct xdr_stream *xdr, int nbytes)
55{ 55{
56 uint32_t *p; 56 __be32 *p;
57 57
58 p = xdr_inline_decode(xdr, nbytes); 58 p = xdr_inline_decode(xdr, nbytes);
59 if (unlikely(p == NULL)) 59 if (unlikely(p == NULL))
@@ -61,9 +61,9 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes)
61 return p; 61 return p;
62} 62}
63 63
64static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) 64static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str)
65{ 65{
66 uint32_t *p; 66 __be32 *p;
67 67
68 p = read_buf(xdr, 4); 68 p = read_buf(xdr, 4);
69 if (unlikely(p == NULL)) 69 if (unlikely(p == NULL))
@@ -81,9 +81,9 @@ static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const c
81 return 0; 81 return 0;
82} 82}
83 83
84static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) 84static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
85{ 85{
86 uint32_t *p; 86 __be32 *p;
87 87
88 p = read_buf(xdr, 4); 88 p = read_buf(xdr, 4);
89 if (unlikely(p == NULL)) 89 if (unlikely(p == NULL))
@@ -99,9 +99,9 @@ static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
99 return 0; 99 return 0;
100} 100}
101 101
102static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 102static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
103{ 103{
104 uint32_t *p; 104 __be32 *p;
105 unsigned int attrlen; 105 unsigned int attrlen;
106 106
107 p = read_buf(xdr, 4); 107 p = read_buf(xdr, 4);
@@ -118,9 +118,9 @@ static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
118 return 0; 118 return 0;
119} 119}
120 120
121static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) 121static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
122{ 122{
123 uint32_t *p; 123 __be32 *p;
124 124
125 p = read_buf(xdr, 16); 125 p = read_buf(xdr, 16);
126 if (unlikely(p == NULL)) 126 if (unlikely(p == NULL))
@@ -129,11 +129,11 @@ static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
129 return 0; 129 return 0;
130} 130}
131 131
132static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) 132static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
133{ 133{
134 uint32_t *p; 134 __be32 *p;
135 unsigned int minor_version; 135 unsigned int minor_version;
136 unsigned status; 136 __be32 status;
137 137
138 status = decode_string(xdr, &hdr->taglen, &hdr->tag); 138 status = decode_string(xdr, &hdr->taglen, &hdr->tag);
139 if (unlikely(status != 0)) 139 if (unlikely(status != 0))
@@ -159,9 +159,9 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou
159 return 0; 159 return 0;
160} 160}
161 161
162static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) 162static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
163{ 163{
164 uint32_t *p; 164 __be32 *p;
165 p = read_buf(xdr, 4); 165 p = read_buf(xdr, 4);
166 if (unlikely(p == NULL)) 166 if (unlikely(p == NULL))
167 return htonl(NFS4ERR_RESOURCE); 167 return htonl(NFS4ERR_RESOURCE);
@@ -169,9 +169,9 @@ static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
169 return 0; 169 return 0;
170} 170}
171 171
172static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) 172static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args)
173{ 173{
174 unsigned status; 174 __be32 status;
175 175
176 status = decode_fh(xdr, &args->fh); 176 status = decode_fh(xdr, &args->fh);
177 if (unlikely(status != 0)) 177 if (unlikely(status != 0))
@@ -183,10 +183,10 @@ out:
183 return status; 183 return status;
184} 184}
185 185
186static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) 186static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
187{ 187{
188 uint32_t *p; 188 __be32 *p;
189 unsigned status; 189 __be32 status;
190 190
191 args->addr = &rqstp->rq_addr; 191 args->addr = &rqstp->rq_addr;
192 status = decode_stateid(xdr, &args->stateid); 192 status = decode_stateid(xdr, &args->stateid);
@@ -204,9 +204,9 @@ out:
204 return status; 204 return status;
205} 205}
206 206
207static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) 207static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
208{ 208{
209 uint32_t *p; 209 __be32 *p;
210 210
211 p = xdr_reserve_space(xdr, 4 + len); 211 p = xdr_reserve_space(xdr, 4 + len);
212 if (unlikely(p == NULL)) 212 if (unlikely(p == NULL))
@@ -217,10 +217,10 @@ static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const ch
217 217
218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) 218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) 219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
220static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep) 220static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, __be32 **savep)
221{ 221{
222 uint32_t bm[2]; 222 __be32 bm[2];
223 uint32_t *p; 223 __be32 *p;
224 224
225 bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); 225 bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0);
226 bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); 226 bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1);
@@ -247,9 +247,9 @@ static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitma
247 return 0; 247 return 0;
248} 248}
249 249
250static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) 250static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
251{ 251{
252 uint32_t *p; 252 __be32 *p;
253 253
254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) 254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE))
255 return 0; 255 return 0;
@@ -260,9 +260,9 @@ static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitma
260 return 0; 260 return 0;
261} 261}
262 262
263static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) 263static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
264{ 264{
265 uint32_t *p; 265 __be32 *p;
266 266
267 if (!(bitmap[0] & FATTR4_WORD0_SIZE)) 267 if (!(bitmap[0] & FATTR4_WORD0_SIZE))
268 return 0; 268 return 0;
@@ -273,9 +273,9 @@ static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap,
273 return 0; 273 return 0;
274} 274}
275 275
276static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) 276static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *time)
277{ 277{
278 uint32_t *p; 278 __be32 *p;
279 279
280 p = xdr_reserve_space(xdr, 12); 280 p = xdr_reserve_space(xdr, 12);
281 if (unlikely(p == 0)) 281 if (unlikely(p == 0))
@@ -285,23 +285,23 @@ static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *
285 return 0; 285 return 0;
286} 286}
287 287
288static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 288static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
289{ 289{
290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) 290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA))
291 return 0; 291 return 0;
292 return encode_attr_time(xdr,time); 292 return encode_attr_time(xdr,time);
293} 293}
294 294
295static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 295static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
296{ 296{
297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) 297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY))
298 return 0; 298 return 0;
299 return encode_attr_time(xdr,time); 299 return encode_attr_time(xdr,time);
300} 300}
301 301
302static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) 302static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
303{ 303{
304 unsigned status; 304 __be32 status;
305 305
306 hdr->status = xdr_reserve_space(xdr, 4); 306 hdr->status = xdr_reserve_space(xdr, 4);
307 if (unlikely(hdr->status == NULL)) 307 if (unlikely(hdr->status == NULL))
@@ -315,9 +315,9 @@ static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compou
315 return 0; 315 return 0;
316} 316}
317 317
318static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) 318static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
319{ 319{
320 uint32_t *p; 320 __be32 *p;
321 321
322 p = xdr_reserve_space(xdr, 8); 322 p = xdr_reserve_space(xdr, 8);
323 if (unlikely(p == NULL)) 323 if (unlikely(p == NULL))
@@ -327,10 +327,10 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
327 return 0; 327 return 0;
328} 328}
329 329
330static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) 330static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
331{ 331{
332 uint32_t *savep = NULL; 332 __be32 *savep = NULL;
333 unsigned status = res->status; 333 __be32 status = res->status;
334 334
335 if (unlikely(status != 0)) 335 if (unlikely(status != 0))
336 goto out; 336 goto out;
@@ -353,15 +353,15 @@ out:
353 return status; 353 return status;
354} 354}
355 355
356static unsigned process_op(struct svc_rqst *rqstp, 356static __be32 process_op(struct svc_rqst *rqstp,
357 struct xdr_stream *xdr_in, void *argp, 357 struct xdr_stream *xdr_in, void *argp,
358 struct xdr_stream *xdr_out, void *resp) 358 struct xdr_stream *xdr_out, void *resp)
359{ 359{
360 struct callback_op *op = &callback_ops[0]; 360 struct callback_op *op = &callback_ops[0];
361 unsigned int op_nr = OP_CB_ILLEGAL; 361 unsigned int op_nr = OP_CB_ILLEGAL;
362 unsigned int status = 0; 362 __be32 status = 0;
363 long maxlen; 363 long maxlen;
364 unsigned res; 364 __be32 res;
365 365
366 dprintk("%s: start\n", __FUNCTION__); 366 dprintk("%s: start\n", __FUNCTION__);
367 status = decode_op_hdr(xdr_in, &op_nr); 367 status = decode_op_hdr(xdr_in, &op_nr);
@@ -399,20 +399,20 @@ static unsigned process_op(struct svc_rqst *rqstp,
399/* 399/*
400 * Decode, process and encode a COMPOUND 400 * Decode, process and encode a COMPOUND
401 */ 401 */
402static int nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp)
403{ 403{
404 struct cb_compound_hdr_arg hdr_arg; 404 struct cb_compound_hdr_arg hdr_arg;
405 struct cb_compound_hdr_res hdr_res; 405 struct cb_compound_hdr_res hdr_res;
406 struct xdr_stream xdr_in, xdr_out; 406 struct xdr_stream xdr_in, xdr_out;
407 uint32_t *p; 407 __be32 *p;
408 unsigned int status; 408 __be32 status;
409 unsigned int nops = 1; 409 unsigned int nops = 1;
410 410
411 dprintk("%s: start\n", __FUNCTION__); 411 dprintk("%s: start\n", __FUNCTION__);
412 412
413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); 413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base);
414 414
415 p = (uint32_t*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); 415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len);
416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p); 416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p);
417 417
418 decode_compound_hdr_arg(&xdr_in, &hdr_arg); 418 decode_compound_hdr_arg(&xdr_in, &hdr_arg);
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 34c3996bd0f5..5fea638743e4 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -232,11 +232,15 @@ void nfs_put_client(struct nfs_client *clp)
232 * Find a client by address 232 * Find a client by address
233 * - caller must hold nfs_client_lock 233 * - caller must hold nfs_client_lock
234 */ 234 */
235static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion) 235static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int nfsversion, int match_port)
236{ 236{
237 struct nfs_client *clp; 237 struct nfs_client *clp;
238 238
239 list_for_each_entry(clp, &nfs_client_list, cl_share_link) { 239 list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
240 /* Don't match clients that failed to initialise properly */
241 if (clp->cl_cons_state < 0)
242 continue;
243
240 /* Different NFS versions cannot share the same nfs_client */ 244 /* Different NFS versions cannot share the same nfs_client */
241 if (clp->cl_nfsversion != nfsversion) 245 if (clp->cl_nfsversion != nfsversion)
242 continue; 246 continue;
@@ -245,7 +249,7 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int
245 sizeof(clp->cl_addr.sin_addr)) != 0) 249 sizeof(clp->cl_addr.sin_addr)) != 0)
246 continue; 250 continue;
247 251
248 if (clp->cl_addr.sin_port == addr->sin_port) 252 if (!match_port || clp->cl_addr.sin_port == addr->sin_port)
249 goto found; 253 goto found;
250 } 254 }
251 255
@@ -265,11 +269,12 @@ struct nfs_client *nfs_find_client(const struct sockaddr_in *addr, int nfsversio
265 struct nfs_client *clp; 269 struct nfs_client *clp;
266 270
267 spin_lock(&nfs_client_lock); 271 spin_lock(&nfs_client_lock);
268 clp = __nfs_find_client(addr, nfsversion); 272 clp = __nfs_find_client(addr, nfsversion, 0);
269 spin_unlock(&nfs_client_lock); 273 spin_unlock(&nfs_client_lock);
270 274 if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) {
271 BUG_ON(clp && clp->cl_cons_state == 0); 275 nfs_put_client(clp);
272 276 clp = NULL;
277 }
273 return clp; 278 return clp;
274} 279}
275 280
@@ -292,7 +297,7 @@ static struct nfs_client *nfs_get_client(const char *hostname,
292 do { 297 do {
293 spin_lock(&nfs_client_lock); 298 spin_lock(&nfs_client_lock);
294 299
295 clp = __nfs_find_client(addr, nfsversion); 300 clp = __nfs_find_client(addr, nfsversion, 1);
296 if (clp) 301 if (clp)
297 goto found_client; 302 goto found_client;
298 if (new) 303 if (new)
@@ -849,6 +854,7 @@ error:
849 */ 854 */
850static int nfs4_init_client(struct nfs_client *clp, 855static int nfs4_init_client(struct nfs_client *clp,
851 int proto, int timeo, int retrans, 856 int proto, int timeo, int retrans,
857 const char *ip_addr,
852 rpc_authflavor_t authflavour) 858 rpc_authflavor_t authflavour)
853{ 859{
854 int error; 860 int error;
@@ -865,6 +871,7 @@ static int nfs4_init_client(struct nfs_client *clp,
865 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour); 871 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour);
866 if (error < 0) 872 if (error < 0)
867 goto error; 873 goto error;
874 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
868 875
869 error = nfs_idmap_new(clp); 876 error = nfs_idmap_new(clp);
870 if (error < 0) { 877 if (error < 0) {
@@ -888,6 +895,7 @@ error:
888 */ 895 */
889static int nfs4_set_client(struct nfs_server *server, 896static int nfs4_set_client(struct nfs_server *server,
890 const char *hostname, const struct sockaddr_in *addr, 897 const char *hostname, const struct sockaddr_in *addr,
898 const char *ip_addr,
891 rpc_authflavor_t authflavour, 899 rpc_authflavor_t authflavour,
892 int proto, int timeo, int retrans) 900 int proto, int timeo, int retrans)
893{ 901{
@@ -902,7 +910,7 @@ static int nfs4_set_client(struct nfs_server *server,
902 error = PTR_ERR(clp); 910 error = PTR_ERR(clp);
903 goto error; 911 goto error;
904 } 912 }
905 error = nfs4_init_client(clp, proto, timeo, retrans, authflavour); 913 error = nfs4_init_client(clp, proto, timeo, retrans, ip_addr, authflavour);
906 if (error < 0) 914 if (error < 0)
907 goto error_put; 915 goto error_put;
908 916
@@ -971,7 +979,7 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data,
971 return ERR_PTR(-ENOMEM); 979 return ERR_PTR(-ENOMEM);
972 980
973 /* Get a client record */ 981 /* Get a client record */
974 error = nfs4_set_client(server, hostname, addr, authflavour, 982 error = nfs4_set_client(server, hostname, addr, ip_addr, authflavour,
975 data->proto, data->timeo, data->retrans); 983 data->proto, data->timeo, data->retrans);
976 if (error < 0) 984 if (error < 0)
977 goto error; 985 goto error;
@@ -1041,6 +1049,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1041 /* Get a client representation. 1049 /* Get a client representation.
1042 * Note: NFSv4 always uses TCP, */ 1050 * Note: NFSv4 always uses TCP, */
1043 error = nfs4_set_client(server, data->hostname, data->addr, 1051 error = nfs4_set_client(server, data->hostname, data->addr,
1052 parent_client->cl_ipaddr,
1044 data->authflavor, 1053 data->authflavor,
1045 parent_server->client->cl_xprt->prot, 1054 parent_server->client->cl_xprt->prot,
1046 parent_client->retrans_timeo, 1055 parent_client->retrans_timeo,
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 481f8892a919..4133ef5264e5 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -142,12 +142,12 @@ nfs_opendir(struct inode *inode, struct file *filp)
142 return res; 142 return res;
143} 143}
144 144
145typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int); 145typedef __be32 * (*decode_dirent_t)(__be32 *, struct nfs_entry *, int);
146typedef struct { 146typedef struct {
147 struct file *file; 147 struct file *file;
148 struct page *page; 148 struct page *page;
149 unsigned long page_index; 149 unsigned long page_index;
150 u32 *ptr; 150 __be32 *ptr;
151 u64 *dir_cookie; 151 u64 *dir_cookie;
152 loff_t current_index; 152 loff_t current_index;
153 struct nfs_entry *entry; 153 struct nfs_entry *entry;
@@ -203,8 +203,10 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
203 * Note: assumes we have exclusive access to this mapping either 203 * Note: assumes we have exclusive access to this mapping either
204 * through inode->i_mutex or some other mechanism. 204 * through inode->i_mutex or some other mechanism.
205 */ 205 */
206 if (page->index == 0) 206 if (page->index == 0 && invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1) < 0) {
207 invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1); 207 /* Should never happen */
208 nfs_zap_mapping(inode, inode->i_mapping);
209 }
208 unlock_page(page); 210 unlock_page(page);
209 return 0; 211 return 0;
210 error: 212 error:
@@ -218,7 +220,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
218static inline 220static inline
219int dir_decode(nfs_readdir_descriptor_t *desc) 221int dir_decode(nfs_readdir_descriptor_t *desc)
220{ 222{
221 u32 *p = desc->ptr; 223 __be32 *p = desc->ptr;
222 p = desc->decode(p, desc->entry, desc->plus); 224 p = desc->decode(p, desc->entry, desc->plus);
223 if (IS_ERR(p)) 225 if (IS_ERR(p))
224 return PTR_ERR(p); 226 return PTR_ERR(p);
@@ -1517,8 +1519,8 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
1517 pagevec_init(&lru_pvec, 0); 1519 pagevec_init(&lru_pvec, 0);
1518 if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0, 1520 if (!add_to_page_cache(page, dentry->d_inode->i_mapping, 0,
1519 GFP_KERNEL)) { 1521 GFP_KERNEL)) {
1520 if (!pagevec_add(&lru_pvec, page)) 1522 pagevec_add(&lru_pvec, page);
1521 __pagevec_lru_add(&lru_pvec); 1523 pagevec_lru_add(&lru_pvec);
1522 SetPageUptodate(page); 1524 SetPageUptodate(page);
1523 unlock_page(page); 1525 unlock_page(page);
1524 } else 1526 } else
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 9f7f8b9ea1e2..bdfabf854a51 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -497,6 +497,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
497 if (dreq->commit_data != NULL) 497 if (dreq->commit_data != NULL)
498 nfs_commit_free(dreq->commit_data); 498 nfs_commit_free(dreq->commit_data);
499 nfs_direct_free_writedata(dreq); 499 nfs_direct_free_writedata(dreq);
500 nfs_zap_mapping(inode, inode->i_mapping);
500 nfs_direct_complete(dreq); 501 nfs_direct_complete(dreq);
501 } 502 }
502} 503}
@@ -517,6 +518,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
517{ 518{
518 nfs_end_data_update(inode); 519 nfs_end_data_update(inode);
519 nfs_direct_free_writedata(dreq); 520 nfs_direct_free_writedata(dreq);
521 nfs_zap_mapping(inode, inode->i_mapping);
520 nfs_direct_complete(dreq); 522 nfs_direct_complete(dreq);
521} 523}
522#endif 524#endif
@@ -532,10 +534,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
532 534
533 spin_lock(&dreq->lock); 535 spin_lock(&dreq->lock);
534 536
535 if (likely(status >= 0)) 537 if (unlikely(status < 0)) {
536 dreq->count += data->res.count; 538 dreq->error = status;
537 else 539 goto out_unlock;
538 dreq->error = task->tk_status; 540 }
541
542 dreq->count += data->res.count;
539 543
540 if (data->res.verf->committed != NFS_FILE_SYNC) { 544 if (data->res.verf->committed != NFS_FILE_SYNC) {
541 switch (dreq->flags) { 545 switch (dreq->flags) {
@@ -550,7 +554,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
550 } 554 }
551 } 555 }
552 } 556 }
553 557out_unlock:
554 spin_unlock(&dreq->lock); 558 spin_unlock(&dreq->lock);
555} 559}
556 560
@@ -828,17 +832,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
828 832
829 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); 833 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos);
830 834
831 /*
832 * XXX: nfs_end_data_update() already ensures this file's
833 * cached data is subsequently invalidated. Do we really
834 * need to call invalidate_inode_pages2() again here?
835 *
836 * For aio writes, this invalidation will almost certainly
837 * occur before the writes complete. Kind of racey.
838 */
839 if (mapping->nrpages)
840 invalidate_inode_pages2(mapping);
841
842 if (retval > 0) 835 if (retval > 0)
843 iocb->ki_pos = pos + retval; 836 iocb->ki_pos = pos + retval;
844 837
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index bc9376ca86cd..08cc4c5919ab 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -131,6 +131,15 @@ void nfs_zap_caches(struct inode *inode)
131 spin_unlock(&inode->i_lock); 131 spin_unlock(&inode->i_lock);
132} 132}
133 133
134void nfs_zap_mapping(struct inode *inode, struct address_space *mapping)
135{
136 if (mapping->nrpages != 0) {
137 spin_lock(&inode->i_lock);
138 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
139 spin_unlock(&inode->i_lock);
140 }
141}
142
134static void nfs_zap_acl_cache(struct inode *inode) 143static void nfs_zap_acl_cache(struct inode *inode)
135{ 144{
136 void (*clear_acl_cache)(struct inode *); 145 void (*clear_acl_cache)(struct inode *);
@@ -574,7 +583,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
574 583
575 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); 584 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE);
576 lock_kernel(); 585 lock_kernel();
577 if (!inode || is_bad_inode(inode)) 586 if (is_bad_inode(inode))
578 goto out_nowait; 587 goto out_nowait;
579 if (NFS_STALE(inode)) 588 if (NFS_STALE(inode))
580 goto out_nowait; 589 goto out_nowait;
@@ -671,13 +680,20 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
671 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) 680 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
672 || nfs_attribute_timeout(inode)) 681 || nfs_attribute_timeout(inode))
673 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); 682 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
683 if (ret < 0)
684 goto out;
674 685
675 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { 686 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) {
676 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); 687 if (mapping->nrpages != 0) {
677 if (S_ISREG(inode->i_mode)) 688 if (S_ISREG(inode->i_mode)) {
678 nfs_sync_mapping(mapping); 689 ret = nfs_sync_mapping(mapping);
679 invalidate_inode_pages2(mapping); 690 if (ret < 0)
680 691 goto out;
692 }
693 ret = invalidate_inode_pages2(mapping);
694 if (ret < 0)
695 goto out;
696 }
681 spin_lock(&inode->i_lock); 697 spin_lock(&inode->i_lock);
682 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; 698 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
683 if (S_ISDIR(inode->i_mode)) { 699 if (S_ISDIR(inode->i_mode)) {
@@ -687,10 +703,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
687 } 703 }
688 spin_unlock(&inode->i_lock); 704 spin_unlock(&inode->i_lock);
689 705
706 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
690 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", 707 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
691 inode->i_sb->s_id, 708 inode->i_sb->s_id,
692 (long long)NFS_FILEID(inode)); 709 (long long)NFS_FILEID(inode));
693 } 710 }
711out:
694 return ret; 712 return ret;
695} 713}
696 714
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index bea0b016bd70..d205466233f6 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -93,15 +93,15 @@ extern void nfs_destroy_directcache(void);
93/* nfs2xdr.c */ 93/* nfs2xdr.c */
94extern int nfs_stat_to_errno(int); 94extern int nfs_stat_to_errno(int);
95extern struct rpc_procinfo nfs_procedures[]; 95extern struct rpc_procinfo nfs_procedures[];
96extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); 96extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int);
97 97
98/* nfs3xdr.c */ 98/* nfs3xdr.c */
99extern struct rpc_procinfo nfs3_procedures[]; 99extern struct rpc_procinfo nfs3_procedures[];
100extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); 100extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int);
101 101
102/* nfs4xdr.c */ 102/* nfs4xdr.c */
103#ifdef CONFIG_NFS_V4 103#ifdef CONFIG_NFS_V4
104extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); 104extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
105#endif 105#endif
106 106
107/* nfs4proc.c */ 107/* nfs4proc.c */
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index d507b021207f..f75fe72b4160 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -95,7 +95,7 @@ mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version,
95 * XDR encode/decode functions for MOUNT 95 * XDR encode/decode functions for MOUNT
96 */ 96 */
97static int 97static int
98xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path) 98xdr_encode_dirpath(struct rpc_rqst *req, __be32 *p, const char *path)
99{ 99{
100 p = xdr_encode_string(p, path); 100 p = xdr_encode_string(p, path);
101 101
@@ -104,7 +104,7 @@ xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path)
104} 104}
105 105
106static int 106static int
107xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) 107xdr_decode_fhstatus(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res)
108{ 108{
109 struct nfs_fh *fh = res->fh; 109 struct nfs_fh *fh = res->fh;
110 110
@@ -116,7 +116,7 @@ xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res)
116} 116}
117 117
118static int 118static int
119xdr_decode_fhstatus3(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) 119xdr_decode_fhstatus3(struct rpc_rqst *req, __be32 *p, struct mnt_fhstatus *res)
120{ 120{
121 struct nfs_fh *fh = res->fh; 121 struct nfs_fh *fh = res->fh;
122 122
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index b49501fc0a79..3be4e72a0227 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -66,15 +66,15 @@
66/* 66/*
67 * Common NFS XDR functions as inlines 67 * Common NFS XDR functions as inlines
68 */ 68 */
69static inline u32 * 69static inline __be32 *
70xdr_encode_fhandle(u32 *p, struct nfs_fh *fhandle) 70xdr_encode_fhandle(__be32 *p, struct nfs_fh *fhandle)
71{ 71{
72 memcpy(p, fhandle->data, NFS2_FHSIZE); 72 memcpy(p, fhandle->data, NFS2_FHSIZE);
73 return p + XDR_QUADLEN(NFS2_FHSIZE); 73 return p + XDR_QUADLEN(NFS2_FHSIZE);
74} 74}
75 75
76static inline u32 * 76static inline __be32 *
77xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) 77xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle)
78{ 78{
79 /* NFSv2 handles have a fixed length */ 79 /* NFSv2 handles have a fixed length */
80 fhandle->size = NFS2_FHSIZE; 80 fhandle->size = NFS2_FHSIZE;
@@ -82,8 +82,8 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle)
82 return p + XDR_QUADLEN(NFS2_FHSIZE); 82 return p + XDR_QUADLEN(NFS2_FHSIZE);
83} 83}
84 84
85static inline u32* 85static inline __be32*
86xdr_encode_time(u32 *p, struct timespec *timep) 86xdr_encode_time(__be32 *p, struct timespec *timep)
87{ 87{
88 *p++ = htonl(timep->tv_sec); 88 *p++ = htonl(timep->tv_sec);
89 /* Convert nanoseconds into microseconds */ 89 /* Convert nanoseconds into microseconds */
@@ -91,8 +91,8 @@ xdr_encode_time(u32 *p, struct timespec *timep)
91 return p; 91 return p;
92} 92}
93 93
94static inline u32* 94static inline __be32*
95xdr_encode_current_server_time(u32 *p, struct timespec *timep) 95xdr_encode_current_server_time(__be32 *p, struct timespec *timep)
96{ 96{
97 /* 97 /*
98 * Passing the invalid value useconds=1000000 is a 98 * Passing the invalid value useconds=1000000 is a
@@ -108,8 +108,8 @@ xdr_encode_current_server_time(u32 *p, struct timespec *timep)
108 return p; 108 return p;
109} 109}
110 110
111static inline u32* 111static inline __be32*
112xdr_decode_time(u32 *p, struct timespec *timep) 112xdr_decode_time(__be32 *p, struct timespec *timep)
113{ 113{
114 timep->tv_sec = ntohl(*p++); 114 timep->tv_sec = ntohl(*p++);
115 /* Convert microseconds into nanoseconds */ 115 /* Convert microseconds into nanoseconds */
@@ -117,8 +117,8 @@ xdr_decode_time(u32 *p, struct timespec *timep)
117 return p; 117 return p;
118} 118}
119 119
120static u32 * 120static __be32 *
121xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) 121xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
122{ 122{
123 u32 rdev; 123 u32 rdev;
124 fattr->type = (enum nfs_ftype) ntohl(*p++); 124 fattr->type = (enum nfs_ftype) ntohl(*p++);
@@ -146,10 +146,10 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
146 return p; 146 return p;
147} 147}
148 148
149static inline u32 * 149static inline __be32 *
150xdr_encode_sattr(u32 *p, struct iattr *attr) 150xdr_encode_sattr(__be32 *p, struct iattr *attr)
151{ 151{
152 const u32 not_set = __constant_htonl(0xFFFFFFFF); 152 const __be32 not_set = __constant_htonl(0xFFFFFFFF);
153 153
154 *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; 154 *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set;
155 *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; 155 *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set;
@@ -184,7 +184,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
184 * GETATTR, READLINK, STATFS 184 * GETATTR, READLINK, STATFS
185 */ 185 */
186static int 186static int
187nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) 187nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
188{ 188{
189 p = xdr_encode_fhandle(p, fh); 189 p = xdr_encode_fhandle(p, fh);
190 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); 190 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -195,7 +195,7 @@ nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh)
195 * Encode SETATTR arguments 195 * Encode SETATTR arguments
196 */ 196 */
197static int 197static int
198nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) 198nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args)
199{ 199{
200 p = xdr_encode_fhandle(p, args->fh); 200 p = xdr_encode_fhandle(p, args->fh);
201 p = xdr_encode_sattr(p, args->sattr); 201 p = xdr_encode_sattr(p, args->sattr);
@@ -208,7 +208,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args)
208 * LOOKUP, REMOVE, RMDIR 208 * LOOKUP, REMOVE, RMDIR
209 */ 209 */
210static int 210static int
211nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) 211nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
212{ 212{
213 p = xdr_encode_fhandle(p, args->fh); 213 p = xdr_encode_fhandle(p, args->fh);
214 p = xdr_encode_array(p, args->name, args->len); 214 p = xdr_encode_array(p, args->name, args->len);
@@ -222,7 +222,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args)
222 * exactly to the page we want to fetch. 222 * exactly to the page we want to fetch.
223 */ 223 */
224static int 224static int
225nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) 225nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
226{ 226{
227 struct rpc_auth *auth = req->rq_task->tk_auth; 227 struct rpc_auth *auth = req->rq_task->tk_auth;
228 unsigned int replen; 228 unsigned int replen;
@@ -246,7 +246,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
246 * Decode READ reply 246 * Decode READ reply
247 */ 247 */
248static int 248static int
249nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) 249nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
250{ 250{
251 struct kvec *iov = req->rq_rcv_buf.head; 251 struct kvec *iov = req->rq_rcv_buf.head;
252 int status, count, recvd, hdrlen; 252 int status, count, recvd, hdrlen;
@@ -286,7 +286,7 @@ nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
286 * Write arguments. Splice the buffer to be written into the iovec. 286 * Write arguments. Splice the buffer to be written into the iovec.
287 */ 287 */
288static int 288static int
289nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 289nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
290{ 290{
291 struct xdr_buf *sndbuf = &req->rq_snd_buf; 291 struct xdr_buf *sndbuf = &req->rq_snd_buf;
292 u32 offset = (u32)args->offset; 292 u32 offset = (u32)args->offset;
@@ -309,7 +309,7 @@ nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
309 * CREATE, MKDIR 309 * CREATE, MKDIR
310 */ 310 */
311static int 311static int
312nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) 312nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args)
313{ 313{
314 p = xdr_encode_fhandle(p, args->fh); 314 p = xdr_encode_fhandle(p, args->fh);
315 p = xdr_encode_array(p, args->name, args->len); 315 p = xdr_encode_array(p, args->name, args->len);
@@ -322,7 +322,7 @@ nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args)
322 * Encode RENAME arguments 322 * Encode RENAME arguments
323 */ 323 */
324static int 324static int
325nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) 325nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args)
326{ 326{
327 p = xdr_encode_fhandle(p, args->fromfh); 327 p = xdr_encode_fhandle(p, args->fromfh);
328 p = xdr_encode_array(p, args->fromname, args->fromlen); 328 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -336,7 +336,7 @@ nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args)
336 * Encode LINK arguments 336 * Encode LINK arguments
337 */ 337 */
338static int 338static int
339nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) 339nfs_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs_linkargs *args)
340{ 340{
341 p = xdr_encode_fhandle(p, args->fromfh); 341 p = xdr_encode_fhandle(p, args->fromfh);
342 p = xdr_encode_fhandle(p, args->tofh); 342 p = xdr_encode_fhandle(p, args->tofh);
@@ -349,7 +349,7 @@ nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args)
349 * Encode SYMLINK arguments 349 * Encode SYMLINK arguments
350 */ 350 */
351static int 351static int
352nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) 352nfs_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_symlinkargs *args)
353{ 353{
354 struct xdr_buf *sndbuf = &req->rq_snd_buf; 354 struct xdr_buf *sndbuf = &req->rq_snd_buf;
355 size_t pad; 355 size_t pad;
@@ -378,7 +378,7 @@ nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args)
378 * Encode arguments to readdir call 378 * Encode arguments to readdir call
379 */ 379 */
380static int 380static int
381nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) 381nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args)
382{ 382{
383 struct rpc_task *task = req->rq_task; 383 struct rpc_task *task = req->rq_task;
384 struct rpc_auth *auth = task->tk_auth; 384 struct rpc_auth *auth = task->tk_auth;
@@ -404,7 +404,7 @@ nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args)
404 * from nfs_readdir for each entry. 404 * from nfs_readdir for each entry.
405 */ 405 */
406static int 406static int
407nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) 407nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy)
408{ 408{
409 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 409 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
410 struct kvec *iov = rcvbuf->head; 410 struct kvec *iov = rcvbuf->head;
@@ -412,7 +412,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy)
412 int hdrlen, recvd; 412 int hdrlen, recvd;
413 int status, nr; 413 int status, nr;
414 unsigned int len, pglen; 414 unsigned int len, pglen;
415 u32 *end, *entry, *kaddr; 415 __be32 *end, *entry, *kaddr;
416 416
417 if ((status = ntohl(*p++))) 417 if ((status = ntohl(*p++)))
418 return -nfs_stat_to_errno(status); 418 return -nfs_stat_to_errno(status);
@@ -432,8 +432,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy)
432 if (pglen > recvd) 432 if (pglen > recvd)
433 pglen = recvd; 433 pglen = recvd;
434 page = rcvbuf->pages; 434 page = rcvbuf->pages;
435 kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); 435 kaddr = p = kmap_atomic(*page, KM_USER0);
436 end = (u32 *)((char *)p + pglen); 436 end = (__be32 *)((char *)p + pglen);
437 entry = p; 437 entry = p;
438 for (nr = 0; *p++; nr++) { 438 for (nr = 0; *p++; nr++) {
439 if (p + 2 > end) 439 if (p + 2 > end)
@@ -468,8 +468,8 @@ err_unmap:
468 goto out; 468 goto out;
469} 469}
470 470
471u32 * 471__be32 *
472nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) 472nfs_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
473{ 473{
474 if (!*p++) { 474 if (!*p++) {
475 if (!*p) 475 if (!*p)
@@ -496,7 +496,7 @@ nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
496 * Decode simple status reply 496 * Decode simple status reply
497 */ 497 */
498static int 498static int
499nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) 499nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy)
500{ 500{
501 int status; 501 int status;
502 502
@@ -510,7 +510,7 @@ nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy)
510 * GETATTR, SETATTR, WRITE 510 * GETATTR, SETATTR, WRITE
511 */ 511 */
512static int 512static int
513nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 513nfs_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
514{ 514{
515 int status; 515 int status;
516 516
@@ -525,7 +525,7 @@ nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
525 * LOOKUP, CREATE, MKDIR 525 * LOOKUP, CREATE, MKDIR
526 */ 526 */
527static int 527static int
528nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) 528nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res)
529{ 529{
530 int status; 530 int status;
531 531
@@ -540,7 +540,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res)
540 * Encode READLINK args 540 * Encode READLINK args
541 */ 541 */
542static int 542static int
543nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args) 543nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args)
544{ 544{
545 struct rpc_auth *auth = req->rq_task->tk_auth; 545 struct rpc_auth *auth = req->rq_task->tk_auth;
546 unsigned int replen; 546 unsigned int replen;
@@ -558,7 +558,7 @@ nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args
558 * Decode READLINK reply 558 * Decode READLINK reply
559 */ 559 */
560static int 560static int
561nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) 561nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy)
562{ 562{
563 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 563 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
564 struct kvec *iov = rcvbuf->head; 564 struct kvec *iov = rcvbuf->head;
@@ -601,7 +601,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy)
601 * Decode WRITE reply 601 * Decode WRITE reply
602 */ 602 */
603static int 603static int
604nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 604nfs_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
605{ 605{
606 res->verf->committed = NFS_FILE_SYNC; 606 res->verf->committed = NFS_FILE_SYNC;
607 return nfs_xdr_attrstat(req, p, res->fattr); 607 return nfs_xdr_attrstat(req, p, res->fattr);
@@ -611,7 +611,7 @@ nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
611 * Decode STATFS reply 611 * Decode STATFS reply
612 */ 612 */
613static int 613static int
614nfs_xdr_statfsres(struct rpc_rqst *req, u32 *p, struct nfs2_fsstat *res) 614nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res)
615{ 615{
616 int status; 616 int status;
617 617
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 3b234d4601e7..e5f128ffc32d 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -668,7 +668,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
668{ 668{
669 struct inode *dir = dentry->d_inode; 669 struct inode *dir = dentry->d_inode;
670 struct nfs_fattr dir_attr; 670 struct nfs_fattr dir_attr;
671 u32 *verf = NFS_COOKIEVERF(dir); 671 __be32 *verf = NFS_COOKIEVERF(dir);
672 struct nfs3_readdirargs arg = { 672 struct nfs3_readdirargs arg = {
673 .fh = NFS_FH(dir), 673 .fh = NFS_FH(dir),
674 .cookie = cookie, 674 .cookie = cookie,
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 16556fa4effb..0ace092d126f 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -105,14 +105,14 @@ static struct {
105/* 105/*
106 * Common NFS XDR functions as inlines 106 * Common NFS XDR functions as inlines
107 */ 107 */
108static inline u32 * 108static inline __be32 *
109xdr_encode_fhandle(u32 *p, struct nfs_fh *fh) 109xdr_encode_fhandle(__be32 *p, struct nfs_fh *fh)
110{ 110{
111 return xdr_encode_array(p, fh->data, fh->size); 111 return xdr_encode_array(p, fh->data, fh->size);
112} 112}
113 113
114static inline u32 * 114static inline __be32 *
115xdr_decode_fhandle(u32 *p, struct nfs_fh *fh) 115xdr_decode_fhandle(__be32 *p, struct nfs_fh *fh)
116{ 116{
117 if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) { 117 if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) {
118 memcpy(fh->data, p, fh->size); 118 memcpy(fh->data, p, fh->size);
@@ -124,24 +124,24 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fh)
124/* 124/*
125 * Encode/decode time. 125 * Encode/decode time.
126 */ 126 */
127static inline u32 * 127static inline __be32 *
128xdr_encode_time3(u32 *p, struct timespec *timep) 128xdr_encode_time3(__be32 *p, struct timespec *timep)
129{ 129{
130 *p++ = htonl(timep->tv_sec); 130 *p++ = htonl(timep->tv_sec);
131 *p++ = htonl(timep->tv_nsec); 131 *p++ = htonl(timep->tv_nsec);
132 return p; 132 return p;
133} 133}
134 134
135static inline u32 * 135static inline __be32 *
136xdr_decode_time3(u32 *p, struct timespec *timep) 136xdr_decode_time3(__be32 *p, struct timespec *timep)
137{ 137{
138 timep->tv_sec = ntohl(*p++); 138 timep->tv_sec = ntohl(*p++);
139 timep->tv_nsec = ntohl(*p++); 139 timep->tv_nsec = ntohl(*p++);
140 return p; 140 return p;
141} 141}
142 142
143static u32 * 143static __be32 *
144xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) 144xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
145{ 145{
146 unsigned int type, major, minor; 146 unsigned int type, major, minor;
147 int fmode; 147 int fmode;
@@ -177,8 +177,8 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
177 return p; 177 return p;
178} 178}
179 179
180static inline u32 * 180static inline __be32 *
181xdr_encode_sattr(u32 *p, struct iattr *attr) 181xdr_encode_sattr(__be32 *p, struct iattr *attr)
182{ 182{
183 if (attr->ia_valid & ATTR_MODE) { 183 if (attr->ia_valid & ATTR_MODE) {
184 *p++ = xdr_one; 184 *p++ = xdr_one;
@@ -223,8 +223,8 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
223 return p; 223 return p;
224} 224}
225 225
226static inline u32 * 226static inline __be32 *
227xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr) 227xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr)
228{ 228{
229 p = xdr_decode_hyper(p, &fattr->pre_size); 229 p = xdr_decode_hyper(p, &fattr->pre_size);
230 p = xdr_decode_time3(p, &fattr->pre_mtime); 230 p = xdr_decode_time3(p, &fattr->pre_mtime);
@@ -233,16 +233,16 @@ xdr_decode_wcc_attr(u32 *p, struct nfs_fattr *fattr)
233 return p; 233 return p;
234} 234}
235 235
236static inline u32 * 236static inline __be32 *
237xdr_decode_post_op_attr(u32 *p, struct nfs_fattr *fattr) 237xdr_decode_post_op_attr(__be32 *p, struct nfs_fattr *fattr)
238{ 238{
239 if (*p++) 239 if (*p++)
240 p = xdr_decode_fattr(p, fattr); 240 p = xdr_decode_fattr(p, fattr);
241 return p; 241 return p;
242} 242}
243 243
244static inline u32 * 244static inline __be32 *
245xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr) 245xdr_decode_pre_op_attr(__be32 *p, struct nfs_fattr *fattr)
246{ 246{
247 if (*p++) 247 if (*p++)
248 return xdr_decode_wcc_attr(p, fattr); 248 return xdr_decode_wcc_attr(p, fattr);
@@ -250,8 +250,8 @@ xdr_decode_pre_op_attr(u32 *p, struct nfs_fattr *fattr)
250} 250}
251 251
252 252
253static inline u32 * 253static inline __be32 *
254xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr) 254xdr_decode_wcc_data(__be32 *p, struct nfs_fattr *fattr)
255{ 255{
256 p = xdr_decode_pre_op_attr(p, fattr); 256 p = xdr_decode_pre_op_attr(p, fattr);
257 return xdr_decode_post_op_attr(p, fattr); 257 return xdr_decode_post_op_attr(p, fattr);
@@ -265,7 +265,7 @@ xdr_decode_wcc_data(u32 *p, struct nfs_fattr *fattr)
265 * Encode file handle argument 265 * Encode file handle argument
266 */ 266 */
267static int 267static int
268nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) 268nfs3_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
269{ 269{
270 p = xdr_encode_fhandle(p, fh); 270 p = xdr_encode_fhandle(p, fh);
271 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); 271 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -276,7 +276,7 @@ nfs3_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh)
276 * Encode SETATTR arguments 276 * Encode SETATTR arguments
277 */ 277 */
278static int 278static int
279nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args) 279nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
280{ 280{
281 p = xdr_encode_fhandle(p, args->fh); 281 p = xdr_encode_fhandle(p, args->fh);
282 p = xdr_encode_sattr(p, args->sattr); 282 p = xdr_encode_sattr(p, args->sattr);
@@ -291,7 +291,7 @@ nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args)
291 * Encode directory ops argument 291 * Encode directory ops argument
292 */ 292 */
293static int 293static int
294nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args) 294nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args)
295{ 295{
296 p = xdr_encode_fhandle(p, args->fh); 296 p = xdr_encode_fhandle(p, args->fh);
297 p = xdr_encode_array(p, args->name, args->len); 297 p = xdr_encode_array(p, args->name, args->len);
@@ -303,7 +303,7 @@ nfs3_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs3_diropargs *args)
303 * Encode access() argument 303 * Encode access() argument
304 */ 304 */
305static int 305static int
306nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args) 306nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *args)
307{ 307{
308 p = xdr_encode_fhandle(p, args->fh); 308 p = xdr_encode_fhandle(p, args->fh);
309 *p++ = htonl(args->access); 309 *p++ = htonl(args->access);
@@ -317,7 +317,7 @@ nfs3_xdr_accessargs(struct rpc_rqst *req, u32 *p, struct nfs3_accessargs *args)
317 * exactly to the page we want to fetch. 317 * exactly to the page we want to fetch.
318 */ 318 */
319static int 319static int
320nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) 320nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
321{ 321{
322 struct rpc_auth *auth = req->rq_task->tk_auth; 322 struct rpc_auth *auth = req->rq_task->tk_auth;
323 unsigned int replen; 323 unsigned int replen;
@@ -339,7 +339,7 @@ nfs3_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
339 * Write arguments. Splice the buffer to be written into the iovec. 339 * Write arguments. Splice the buffer to be written into the iovec.
340 */ 340 */
341static int 341static int
342nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 342nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
343{ 343{
344 struct xdr_buf *sndbuf = &req->rq_snd_buf; 344 struct xdr_buf *sndbuf = &req->rq_snd_buf;
345 u32 count = args->count; 345 u32 count = args->count;
@@ -360,7 +360,7 @@ nfs3_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
360 * Encode CREATE arguments 360 * Encode CREATE arguments
361 */ 361 */
362static int 362static int
363nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args) 363nfs3_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs3_createargs *args)
364{ 364{
365 p = xdr_encode_fhandle(p, args->fh); 365 p = xdr_encode_fhandle(p, args->fh);
366 p = xdr_encode_array(p, args->name, args->len); 366 p = xdr_encode_array(p, args->name, args->len);
@@ -380,7 +380,7 @@ nfs3_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs3_createargs *args)
380 * Encode MKDIR arguments 380 * Encode MKDIR arguments
381 */ 381 */
382static int 382static int
383nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args) 383nfs3_xdr_mkdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mkdirargs *args)
384{ 384{
385 p = xdr_encode_fhandle(p, args->fh); 385 p = xdr_encode_fhandle(p, args->fh);
386 p = xdr_encode_array(p, args->name, args->len); 386 p = xdr_encode_array(p, args->name, args->len);
@@ -393,7 +393,7 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_mkdirargs *args)
393 * Encode SYMLINK arguments 393 * Encode SYMLINK arguments
394 */ 394 */
395static int 395static int
396nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args) 396nfs3_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_symlinkargs *args)
397{ 397{
398 p = xdr_encode_fhandle(p, args->fromfh); 398 p = xdr_encode_fhandle(p, args->fromfh);
399 p = xdr_encode_array(p, args->fromname, args->fromlen); 399 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -410,7 +410,7 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_symlinkargs *args
410 * Encode MKNOD arguments 410 * Encode MKNOD arguments
411 */ 411 */
412static int 412static int
413nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args) 413nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args)
414{ 414{
415 p = xdr_encode_fhandle(p, args->fh); 415 p = xdr_encode_fhandle(p, args->fh);
416 p = xdr_encode_array(p, args->name, args->len); 416 p = xdr_encode_array(p, args->name, args->len);
@@ -429,7 +429,7 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args)
429 * Encode RENAME arguments 429 * Encode RENAME arguments
430 */ 430 */
431static int 431static int
432nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args) 432nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs3_renameargs *args)
433{ 433{
434 p = xdr_encode_fhandle(p, args->fromfh); 434 p = xdr_encode_fhandle(p, args->fromfh);
435 p = xdr_encode_array(p, args->fromname, args->fromlen); 435 p = xdr_encode_array(p, args->fromname, args->fromlen);
@@ -443,7 +443,7 @@ nfs3_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs3_renameargs *args)
443 * Encode LINK arguments 443 * Encode LINK arguments
444 */ 444 */
445static int 445static int
446nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args) 446nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args)
447{ 447{
448 p = xdr_encode_fhandle(p, args->fromfh); 448 p = xdr_encode_fhandle(p, args->fromfh);
449 p = xdr_encode_fhandle(p, args->tofh); 449 p = xdr_encode_fhandle(p, args->tofh);
@@ -456,7 +456,7 @@ nfs3_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs3_linkargs *args)
456 * Encode arguments to readdir call 456 * Encode arguments to readdir call
457 */ 457 */
458static int 458static int
459nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args) 459nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args)
460{ 460{
461 struct rpc_auth *auth = req->rq_task->tk_auth; 461 struct rpc_auth *auth = req->rq_task->tk_auth;
462 unsigned int replen; 462 unsigned int replen;
@@ -485,7 +485,7 @@ nfs3_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs3_readdirargs *args
485 * We just check for syntactical correctness. 485 * We just check for syntactical correctness.
486 */ 486 */
487static int 487static int
488nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res) 488nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res)
489{ 489{
490 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 490 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
491 struct kvec *iov = rcvbuf->head; 491 struct kvec *iov = rcvbuf->head;
@@ -493,7 +493,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
493 int hdrlen, recvd; 493 int hdrlen, recvd;
494 int status, nr; 494 int status, nr;
495 unsigned int len, pglen; 495 unsigned int len, pglen;
496 u32 *entry, *end, *kaddr; 496 __be32 *entry, *end, *kaddr;
497 497
498 status = ntohl(*p++); 498 status = ntohl(*p++);
499 /* Decode post_op_attrs */ 499 /* Decode post_op_attrs */
@@ -523,8 +523,8 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
523 if (pglen > recvd) 523 if (pglen > recvd)
524 pglen = recvd; 524 pglen = recvd;
525 page = rcvbuf->pages; 525 page = rcvbuf->pages;
526 kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); 526 kaddr = p = kmap_atomic(*page, KM_USER0);
527 end = (u32 *)((char *)p + pglen); 527 end = (__be32 *)((char *)p + pglen);
528 entry = p; 528 entry = p;
529 for (nr = 0; *p++; nr++) { 529 for (nr = 0; *p++; nr++) {
530 if (p + 3 > end) 530 if (p + 3 > end)
@@ -583,8 +583,8 @@ err_unmap:
583 goto out; 583 goto out;
584} 584}
585 585
586u32 * 586__be32 *
587nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) 587nfs3_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
588{ 588{
589 struct nfs_entry old = *entry; 589 struct nfs_entry old = *entry;
590 590
@@ -626,7 +626,7 @@ nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
626 * Encode COMMIT arguments 626 * Encode COMMIT arguments
627 */ 627 */
628static int 628static int
629nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) 629nfs3_xdr_commitargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
630{ 630{
631 p = xdr_encode_fhandle(p, args->fh); 631 p = xdr_encode_fhandle(p, args->fh);
632 p = xdr_encode_hyper(p, args->offset); 632 p = xdr_encode_hyper(p, args->offset);
@@ -640,7 +640,7 @@ nfs3_xdr_commitargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
640 * Encode GETACL arguments 640 * Encode GETACL arguments
641 */ 641 */
642static int 642static int
643nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p, 643nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p,
644 struct nfs3_getaclargs *args) 644 struct nfs3_getaclargs *args)
645{ 645{
646 struct rpc_auth *auth = req->rq_task->tk_auth; 646 struct rpc_auth *auth = req->rq_task->tk_auth;
@@ -664,7 +664,7 @@ nfs3_xdr_getaclargs(struct rpc_rqst *req, u32 *p,
664 * Encode SETACL arguments 664 * Encode SETACL arguments
665 */ 665 */
666static int 666static int
667nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p, 667nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
668 struct nfs3_setaclargs *args) 668 struct nfs3_setaclargs *args)
669{ 669{
670 struct xdr_buf *buf = &req->rq_snd_buf; 670 struct xdr_buf *buf = &req->rq_snd_buf;
@@ -711,7 +711,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p,
711 * Decode attrstat reply. 711 * Decode attrstat reply.
712 */ 712 */
713static int 713static int
714nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 714nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
715{ 715{
716 int status; 716 int status;
717 717
@@ -726,7 +726,7 @@ nfs3_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
726 * SATTR, REMOVE, RMDIR 726 * SATTR, REMOVE, RMDIR
727 */ 727 */
728static int 728static int
729nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 729nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
730{ 730{
731 int status; 731 int status;
732 732
@@ -740,7 +740,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
740 * Decode LOOKUP reply 740 * Decode LOOKUP reply
741 */ 741 */
742static int 742static int
743nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) 743nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
744{ 744{
745 int status; 745 int status;
746 746
@@ -759,7 +759,7 @@ nfs3_xdr_lookupres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
759 * Decode ACCESS reply 759 * Decode ACCESS reply
760 */ 760 */
761static int 761static int
762nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res) 762nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
763{ 763{
764 int status = ntohl(*p++); 764 int status = ntohl(*p++);
765 765
@@ -771,7 +771,7 @@ nfs3_xdr_accessres(struct rpc_rqst *req, u32 *p, struct nfs3_accessres *res)
771} 771}
772 772
773static int 773static int
774nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *args) 774nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args)
775{ 775{
776 struct rpc_auth *auth = req->rq_task->tk_auth; 776 struct rpc_auth *auth = req->rq_task->tk_auth;
777 unsigned int replen; 777 unsigned int replen;
@@ -789,7 +789,7 @@ nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *ar
789 * Decode READLINK reply 789 * Decode READLINK reply
790 */ 790 */
791static int 791static int
792nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 792nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
793{ 793{
794 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 794 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
795 struct kvec *iov = rcvbuf->head; 795 struct kvec *iov = rcvbuf->head;
@@ -837,7 +837,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
837 * Decode READ reply 837 * Decode READ reply
838 */ 838 */
839static int 839static int
840nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) 840nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
841{ 841{
842 struct kvec *iov = req->rq_rcv_buf.head; 842 struct kvec *iov = req->rq_rcv_buf.head;
843 int status, count, ocount, recvd, hdrlen; 843 int status, count, ocount, recvd, hdrlen;
@@ -888,7 +888,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
888 * Decode WRITE response 888 * Decode WRITE response
889 */ 889 */
890static int 890static int
891nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 891nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
892{ 892{
893 int status; 893 int status;
894 894
@@ -910,7 +910,7 @@ nfs3_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
910 * Decode a CREATE response 910 * Decode a CREATE response
911 */ 911 */
912static int 912static int
913nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res) 913nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
914{ 914{
915 int status; 915 int status;
916 916
@@ -937,7 +937,7 @@ nfs3_xdr_createres(struct rpc_rqst *req, u32 *p, struct nfs3_diropres *res)
937 * Decode RENAME reply 937 * Decode RENAME reply
938 */ 938 */
939static int 939static int
940nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res) 940nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs3_renameres *res)
941{ 941{
942 int status; 942 int status;
943 943
@@ -952,7 +952,7 @@ nfs3_xdr_renameres(struct rpc_rqst *req, u32 *p, struct nfs3_renameres *res)
952 * Decode LINK reply 952 * Decode LINK reply
953 */ 953 */
954static int 954static int
955nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res) 955nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
956{ 956{
957 int status; 957 int status;
958 958
@@ -967,7 +967,7 @@ nfs3_xdr_linkres(struct rpc_rqst *req, u32 *p, struct nfs3_linkres *res)
967 * Decode FSSTAT reply 967 * Decode FSSTAT reply
968 */ 968 */
969static int 969static int
970nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res) 970nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
971{ 971{
972 int status; 972 int status;
973 973
@@ -992,7 +992,7 @@ nfs3_xdr_fsstatres(struct rpc_rqst *req, u32 *p, struct nfs_fsstat *res)
992 * Decode FSINFO reply 992 * Decode FSINFO reply
993 */ 993 */
994static int 994static int
995nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res) 995nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
996{ 996{
997 int status; 997 int status;
998 998
@@ -1020,7 +1020,7 @@ nfs3_xdr_fsinfores(struct rpc_rqst *req, u32 *p, struct nfs_fsinfo *res)
1020 * Decode PATHCONF reply 1020 * Decode PATHCONF reply
1021 */ 1021 */
1022static int 1022static int
1023nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res) 1023nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
1024{ 1024{
1025 int status; 1025 int status;
1026 1026
@@ -1040,7 +1040,7 @@ nfs3_xdr_pathconfres(struct rpc_rqst *req, u32 *p, struct nfs_pathconf *res)
1040 * Decode COMMIT reply 1040 * Decode COMMIT reply
1041 */ 1041 */
1042static int 1042static int
1043nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) 1043nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
1044{ 1044{
1045 int status; 1045 int status;
1046 1046
@@ -1059,7 +1059,7 @@ nfs3_xdr_commitres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res)
1059 * Decode GETACL reply 1059 * Decode GETACL reply
1060 */ 1060 */
1061static int 1061static int
1062nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p, 1062nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
1063 struct nfs3_getaclres *res) 1063 struct nfs3_getaclres *res)
1064{ 1064{
1065 struct xdr_buf *buf = &req->rq_rcv_buf; 1065 struct xdr_buf *buf = &req->rq_rcv_buf;
@@ -1091,7 +1091,7 @@ nfs3_xdr_getaclres(struct rpc_rqst *req, u32 *p,
1091 * Decode setacl reply. 1091 * Decode setacl reply.
1092 */ 1092 */
1093static int 1093static int
1094nfs3_xdr_setaclres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) 1094nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
1095{ 1095{
1096 int status = ntohl(*p++); 1096 int status = ntohl(*p++);
1097 1097
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 61095fe4b5ca..6f346677332d 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -212,7 +212,7 @@ extern void nfs_free_seqid(struct nfs_seqid *seqid);
212extern const nfs4_stateid zero_stateid; 212extern const nfs4_stateid zero_stateid;
213 213
214/* nfs4xdr.c */ 214/* nfs4xdr.c */
215extern uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus); 215extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
216extern struct rpc_procinfo nfs4_procedures[]; 216extern struct rpc_procinfo nfs4_procedures[];
217 217
218struct nfs4_mount_data; 218struct nfs4_mount_data;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 47c7e6e3910d..8118036cc449 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -138,10 +138,10 @@ const u32 nfs4_fs_locations_bitmap[2] = {
138 | FATTR4_WORD1_MOUNTED_ON_FILEID 138 | FATTR4_WORD1_MOUNTED_ON_FILEID
139}; 139};
140 140
141static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, 141static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry,
142 struct nfs4_readdir_arg *readdir) 142 struct nfs4_readdir_arg *readdir)
143{ 143{
144 u32 *start, *p; 144 __be32 *start, *p;
145 145
146 BUG_ON(readdir->count < 80); 146 BUG_ON(readdir->count < 80);
147 if (cookie > 2) { 147 if (cookie > 2) {
@@ -162,7 +162,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry,
162 * when talking to the server, we always send cookie 0 162 * when talking to the server, we always send cookie 0
163 * instead of 1 or 2. 163 * instead of 1 or 2.
164 */ 164 */
165 start = p = (u32 *)kmap_atomic(*readdir->pages, KM_USER0); 165 start = p = kmap_atomic(*readdir->pages, KM_USER0);
166 166
167 if (cookie == 0) { 167 if (cookie == 0) {
168 *p++ = xdr_one; /* next */ 168 *p++ = xdr_one; /* next */
@@ -1314,11 +1314,9 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
1314 case -EROFS: 1314 case -EROFS:
1315 lookup_instantiate_filp(nd, (struct dentry *)state, NULL); 1315 lookup_instantiate_filp(nd, (struct dentry *)state, NULL);
1316 return 1; 1316 return 1;
1317 case -ENOENT: 1317 default:
1318 if (dentry->d_inode == NULL) 1318 goto out_drop;
1319 return 1;
1320 } 1319 }
1321 goto out_drop;
1322 } 1320 }
1323 if (state->inode == dentry->d_inode) { 1321 if (state->inode == dentry->d_inode) {
1324 nfs4_intent_set_file(nd, dentry, state); 1322 nfs4_intent_set_file(nd, dentry, state);
@@ -2917,11 +2915,11 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, unsigned short po
2917 .rpc_resp = clp, 2915 .rpc_resp = clp,
2918 .rpc_cred = cred, 2916 .rpc_cred = cred,
2919 }; 2917 };
2920 u32 *p; 2918 __be32 *p;
2921 int loop = 0; 2919 int loop = 0;
2922 int status; 2920 int status;
2923 2921
2924 p = (u32*)sc_verifier.data; 2922 p = (__be32*)sc_verifier.data;
2925 *p++ = htonl((u32)clp->cl_boot_time.tv_sec); 2923 *p++ = htonl((u32)clp->cl_boot_time.tv_sec);
2926 *p = htonl((u32)clp->cl_boot_time.tv_nsec); 2924 *p = htonl((u32)clp->cl_boot_time.tv_nsec);
2927 2925
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 3dd413f52da1..0cf3fa312a33 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -471,7 +471,7 @@ struct compound_hdr {
471 471
472static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) 472static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
473{ 473{
474 uint32_t *p; 474 __be32 *p;
475 475
476 p = xdr_reserve_space(xdr, 4 + len); 476 p = xdr_reserve_space(xdr, 4 + len);
477 BUG_ON(p == NULL); 477 BUG_ON(p == NULL);
@@ -480,7 +480,7 @@ static void encode_string(struct xdr_stream *xdr, unsigned int len, const char *
480 480
481static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) 481static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
482{ 482{
483 uint32_t *p; 483 __be32 *p;
484 484
485 dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag); 485 dprintk("encode_compound: tag=%.*s\n", (int)hdr->taglen, hdr->tag);
486 BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); 486 BUG_ON(hdr->taglen > NFS4_MAXTAGLEN);
@@ -494,7 +494,7 @@ static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
494 494
495static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) 495static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf)
496{ 496{
497 uint32_t *p; 497 __be32 *p;
498 498
499 p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE); 499 p = xdr_reserve_space(xdr, NFS4_VERIFIER_SIZE);
500 BUG_ON(p == NULL); 500 BUG_ON(p == NULL);
@@ -507,8 +507,8 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
507 char owner_group[IDMAP_NAMESZ]; 507 char owner_group[IDMAP_NAMESZ];
508 int owner_namelen = 0; 508 int owner_namelen = 0;
509 int owner_grouplen = 0; 509 int owner_grouplen = 0;
510 uint32_t *p; 510 __be32 *p;
511 uint32_t *q; 511 __be32 *q;
512 int len; 512 int len;
513 uint32_t bmval0 = 0; 513 uint32_t bmval0 = 0;
514 uint32_t bmval1 = 0; 514 uint32_t bmval1 = 0;
@@ -630,7 +630,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
630 630
631static int encode_access(struct xdr_stream *xdr, u32 access) 631static int encode_access(struct xdr_stream *xdr, u32 access)
632{ 632{
633 uint32_t *p; 633 __be32 *p;
634 634
635 RESERVE_SPACE(8); 635 RESERVE_SPACE(8);
636 WRITE32(OP_ACCESS); 636 WRITE32(OP_ACCESS);
@@ -641,7 +641,7 @@ static int encode_access(struct xdr_stream *xdr, u32 access)
641 641
642static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) 642static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
643{ 643{
644 uint32_t *p; 644 __be32 *p;
645 645
646 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 646 RESERVE_SPACE(8+sizeof(arg->stateid->data));
647 WRITE32(OP_CLOSE); 647 WRITE32(OP_CLOSE);
@@ -653,7 +653,7 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
653 653
654static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) 654static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args)
655{ 655{
656 uint32_t *p; 656 __be32 *p;
657 657
658 RESERVE_SPACE(16); 658 RESERVE_SPACE(16);
659 WRITE32(OP_COMMIT); 659 WRITE32(OP_COMMIT);
@@ -665,7 +665,7 @@ static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *arg
665 665
666static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) 666static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create)
667{ 667{
668 uint32_t *p; 668 __be32 *p;
669 669
670 RESERVE_SPACE(8); 670 RESERVE_SPACE(8);
671 WRITE32(OP_CREATE); 671 WRITE32(OP_CREATE);
@@ -697,7 +697,7 @@ static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *c
697 697
698static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) 698static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap)
699{ 699{
700 uint32_t *p; 700 __be32 *p;
701 701
702 RESERVE_SPACE(12); 702 RESERVE_SPACE(12);
703 WRITE32(OP_GETATTR); 703 WRITE32(OP_GETATTR);
@@ -708,7 +708,7 @@ static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap)
708 708
709static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) 709static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1)
710{ 710{
711 uint32_t *p; 711 __be32 *p;
712 712
713 RESERVE_SPACE(16); 713 RESERVE_SPACE(16);
714 WRITE32(OP_GETATTR); 714 WRITE32(OP_GETATTR);
@@ -740,7 +740,7 @@ static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask)
740 740
741static int encode_getfh(struct xdr_stream *xdr) 741static int encode_getfh(struct xdr_stream *xdr)
742{ 742{
743 uint32_t *p; 743 __be32 *p;
744 744
745 RESERVE_SPACE(4); 745 RESERVE_SPACE(4);
746 WRITE32(OP_GETFH); 746 WRITE32(OP_GETFH);
@@ -750,7 +750,7 @@ static int encode_getfh(struct xdr_stream *xdr)
750 750
751static int encode_link(struct xdr_stream *xdr, const struct qstr *name) 751static int encode_link(struct xdr_stream *xdr, const struct qstr *name)
752{ 752{
753 uint32_t *p; 753 __be32 *p;
754 754
755 RESERVE_SPACE(8 + name->len); 755 RESERVE_SPACE(8 + name->len);
756 WRITE32(OP_LINK); 756 WRITE32(OP_LINK);
@@ -780,7 +780,7 @@ static inline uint64_t nfs4_lock_length(struct file_lock *fl)
780 */ 780 */
781static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) 781static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args)
782{ 782{
783 uint32_t *p; 783 __be32 *p;
784 784
785 RESERVE_SPACE(32); 785 RESERVE_SPACE(32);
786 WRITE32(OP_LOCK); 786 WRITE32(OP_LOCK);
@@ -809,7 +809,7 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args)
809 809
810static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args) 810static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args)
811{ 811{
812 uint32_t *p; 812 __be32 *p;
813 813
814 RESERVE_SPACE(40); 814 RESERVE_SPACE(40);
815 WRITE32(OP_LOCKT); 815 WRITE32(OP_LOCKT);
@@ -825,7 +825,7 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg
825 825
826static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args) 826static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args)
827{ 827{
828 uint32_t *p; 828 __be32 *p;
829 829
830 RESERVE_SPACE(44); 830 RESERVE_SPACE(44);
831 WRITE32(OP_LOCKU); 831 WRITE32(OP_LOCKU);
@@ -841,7 +841,7 @@ static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *arg
841static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) 841static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name)
842{ 842{
843 int len = name->len; 843 int len = name->len;
844 uint32_t *p; 844 __be32 *p;
845 845
846 RESERVE_SPACE(8 + len); 846 RESERVE_SPACE(8 + len);
847 WRITE32(OP_LOOKUP); 847 WRITE32(OP_LOOKUP);
@@ -853,7 +853,7 @@ static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name)
853 853
854static void encode_share_access(struct xdr_stream *xdr, int open_flags) 854static void encode_share_access(struct xdr_stream *xdr, int open_flags)
855{ 855{
856 uint32_t *p; 856 __be32 *p;
857 857
858 RESERVE_SPACE(8); 858 RESERVE_SPACE(8);
859 switch (open_flags & (FMODE_READ|FMODE_WRITE)) { 859 switch (open_flags & (FMODE_READ|FMODE_WRITE)) {
@@ -874,7 +874,7 @@ static void encode_share_access(struct xdr_stream *xdr, int open_flags)
874 874
875static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg) 875static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_openargs *arg)
876{ 876{
877 uint32_t *p; 877 __be32 *p;
878 /* 878 /*
879 * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4, 879 * opcode 4, seqid 4, share_access 4, share_deny 4, clientid 8, ownerlen 4,
880 * owner 4 = 32 880 * owner 4 = 32
@@ -891,7 +891,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
891 891
892static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) 892static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
893{ 893{
894 uint32_t *p; 894 __be32 *p;
895 895
896 RESERVE_SPACE(4); 896 RESERVE_SPACE(4);
897 switch(arg->open_flags & O_EXCL) { 897 switch(arg->open_flags & O_EXCL) {
@@ -907,7 +907,7 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
907 907
908static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg) 908static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *arg)
909{ 909{
910 uint32_t *p; 910 __be32 *p;
911 911
912 RESERVE_SPACE(4); 912 RESERVE_SPACE(4);
913 switch (arg->open_flags & O_CREAT) { 913 switch (arg->open_flags & O_CREAT) {
@@ -923,7 +923,7 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a
923 923
924static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type) 924static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type)
925{ 925{
926 uint32_t *p; 926 __be32 *p;
927 927
928 RESERVE_SPACE(4); 928 RESERVE_SPACE(4);
929 switch (delegation_type) { 929 switch (delegation_type) {
@@ -943,7 +943,7 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation
943 943
944static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name) 944static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *name)
945{ 945{
946 uint32_t *p; 946 __be32 *p;
947 947
948 RESERVE_SPACE(4); 948 RESERVE_SPACE(4);
949 WRITE32(NFS4_OPEN_CLAIM_NULL); 949 WRITE32(NFS4_OPEN_CLAIM_NULL);
@@ -952,7 +952,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr *
952 952
953static inline void encode_claim_previous(struct xdr_stream *xdr, int type) 953static inline void encode_claim_previous(struct xdr_stream *xdr, int type)
954{ 954{
955 uint32_t *p; 955 __be32 *p;
956 956
957 RESERVE_SPACE(4); 957 RESERVE_SPACE(4);
958 WRITE32(NFS4_OPEN_CLAIM_PREVIOUS); 958 WRITE32(NFS4_OPEN_CLAIM_PREVIOUS);
@@ -961,7 +961,7 @@ static inline void encode_claim_previous(struct xdr_stream *xdr, int type)
961 961
962static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid) 962static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struct qstr *name, const nfs4_stateid *stateid)
963{ 963{
964 uint32_t *p; 964 __be32 *p;
965 965
966 RESERVE_SPACE(4+sizeof(stateid->data)); 966 RESERVE_SPACE(4+sizeof(stateid->data));
967 WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); 967 WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR);
@@ -991,7 +991,7 @@ static int encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg)
991 991
992static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg) 992static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg)
993{ 993{
994 uint32_t *p; 994 __be32 *p;
995 995
996 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 996 RESERVE_SPACE(8+sizeof(arg->stateid->data));
997 WRITE32(OP_OPEN_CONFIRM); 997 WRITE32(OP_OPEN_CONFIRM);
@@ -1003,7 +1003,7 @@ static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_con
1003 1003
1004static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg) 1004static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg)
1005{ 1005{
1006 uint32_t *p; 1006 __be32 *p;
1007 1007
1008 RESERVE_SPACE(8+sizeof(arg->stateid->data)); 1008 RESERVE_SPACE(8+sizeof(arg->stateid->data));
1009 WRITE32(OP_OPEN_DOWNGRADE); 1009 WRITE32(OP_OPEN_DOWNGRADE);
@@ -1017,7 +1017,7 @@ static int
1017encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) 1017encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh)
1018{ 1018{
1019 int len = fh->size; 1019 int len = fh->size;
1020 uint32_t *p; 1020 __be32 *p;
1021 1021
1022 RESERVE_SPACE(8 + len); 1022 RESERVE_SPACE(8 + len);
1023 WRITE32(OP_PUTFH); 1023 WRITE32(OP_PUTFH);
@@ -1029,7 +1029,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh)
1029 1029
1030static int encode_putrootfh(struct xdr_stream *xdr) 1030static int encode_putrootfh(struct xdr_stream *xdr)
1031{ 1031{
1032 uint32_t *p; 1032 __be32 *p;
1033 1033
1034 RESERVE_SPACE(4); 1034 RESERVE_SPACE(4);
1035 WRITE32(OP_PUTROOTFH); 1035 WRITE32(OP_PUTROOTFH);
@@ -1040,7 +1040,7 @@ static int encode_putrootfh(struct xdr_stream *xdr)
1040static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) 1040static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx)
1041{ 1041{
1042 nfs4_stateid stateid; 1042 nfs4_stateid stateid;
1043 uint32_t *p; 1043 __be32 *p;
1044 1044
1045 RESERVE_SPACE(16); 1045 RESERVE_SPACE(16);
1046 if (ctx->state != NULL) { 1046 if (ctx->state != NULL) {
@@ -1052,7 +1052,7 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context
1052 1052
1053static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) 1053static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
1054{ 1054{
1055 uint32_t *p; 1055 __be32 *p;
1056 1056
1057 RESERVE_SPACE(4); 1057 RESERVE_SPACE(4);
1058 WRITE32(OP_READ); 1058 WRITE32(OP_READ);
@@ -1074,7 +1074,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1074 FATTR4_WORD1_MOUNTED_ON_FILEID, 1074 FATTR4_WORD1_MOUNTED_ON_FILEID,
1075 }; 1075 };
1076 int replen; 1076 int replen;
1077 uint32_t *p; 1077 __be32 *p;
1078 1078
1079 RESERVE_SPACE(32+sizeof(nfs4_verifier)); 1079 RESERVE_SPACE(32+sizeof(nfs4_verifier));
1080 WRITE32(OP_READDIR); 1080 WRITE32(OP_READDIR);
@@ -1116,7 +1116,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
1116{ 1116{
1117 struct rpc_auth *auth = req->rq_task->tk_auth; 1117 struct rpc_auth *auth = req->rq_task->tk_auth;
1118 unsigned int replen; 1118 unsigned int replen;
1119 uint32_t *p; 1119 __be32 *p;
1120 1120
1121 RESERVE_SPACE(4); 1121 RESERVE_SPACE(4);
1122 WRITE32(OP_READLINK); 1122 WRITE32(OP_READLINK);
@@ -1134,7 +1134,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
1134 1134
1135static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) 1135static int encode_remove(struct xdr_stream *xdr, const struct qstr *name)
1136{ 1136{
1137 uint32_t *p; 1137 __be32 *p;
1138 1138
1139 RESERVE_SPACE(8 + name->len); 1139 RESERVE_SPACE(8 + name->len);
1140 WRITE32(OP_REMOVE); 1140 WRITE32(OP_REMOVE);
@@ -1146,7 +1146,7 @@ static int encode_remove(struct xdr_stream *xdr, const struct qstr *name)
1146 1146
1147static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname) 1147static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname)
1148{ 1148{
1149 uint32_t *p; 1149 __be32 *p;
1150 1150
1151 RESERVE_SPACE(8 + oldname->len); 1151 RESERVE_SPACE(8 + oldname->len);
1152 WRITE32(OP_RENAME); 1152 WRITE32(OP_RENAME);
@@ -1162,7 +1162,7 @@ static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, con
1162 1162
1163static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid) 1163static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid)
1164{ 1164{
1165 uint32_t *p; 1165 __be32 *p;
1166 1166
1167 RESERVE_SPACE(12); 1167 RESERVE_SPACE(12);
1168 WRITE32(OP_RENEW); 1168 WRITE32(OP_RENEW);
@@ -1174,7 +1174,7 @@ static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_
1174static int 1174static int
1175encode_restorefh(struct xdr_stream *xdr) 1175encode_restorefh(struct xdr_stream *xdr)
1176{ 1176{
1177 uint32_t *p; 1177 __be32 *p;
1178 1178
1179 RESERVE_SPACE(4); 1179 RESERVE_SPACE(4);
1180 WRITE32(OP_RESTOREFH); 1180 WRITE32(OP_RESTOREFH);
@@ -1185,7 +1185,7 @@ encode_restorefh(struct xdr_stream *xdr)
1185static int 1185static int
1186encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) 1186encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg)
1187{ 1187{
1188 uint32_t *p; 1188 __be32 *p;
1189 1189
1190 RESERVE_SPACE(4+sizeof(zero_stateid.data)); 1190 RESERVE_SPACE(4+sizeof(zero_stateid.data));
1191 WRITE32(OP_SETATTR); 1191 WRITE32(OP_SETATTR);
@@ -1204,7 +1204,7 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg)
1204static int 1204static int
1205encode_savefh(struct xdr_stream *xdr) 1205encode_savefh(struct xdr_stream *xdr)
1206{ 1206{
1207 uint32_t *p; 1207 __be32 *p;
1208 1208
1209 RESERVE_SPACE(4); 1209 RESERVE_SPACE(4);
1210 WRITE32(OP_SAVEFH); 1210 WRITE32(OP_SAVEFH);
@@ -1215,7 +1215,7 @@ encode_savefh(struct xdr_stream *xdr)
1215static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server) 1215static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server)
1216{ 1216{
1217 int status; 1217 int status;
1218 uint32_t *p; 1218 __be32 *p;
1219 1219
1220 RESERVE_SPACE(4+sizeof(arg->stateid.data)); 1220 RESERVE_SPACE(4+sizeof(arg->stateid.data));
1221 WRITE32(OP_SETATTR); 1221 WRITE32(OP_SETATTR);
@@ -1229,7 +1229,7 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *
1229 1229
1230static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) 1230static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid)
1231{ 1231{
1232 uint32_t *p; 1232 __be32 *p;
1233 1233
1234 RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data)); 1234 RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data));
1235 WRITE32(OP_SETCLIENTID); 1235 WRITE32(OP_SETCLIENTID);
@@ -1248,7 +1248,7 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien
1248 1248
1249static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) 1249static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state)
1250{ 1250{
1251 uint32_t *p; 1251 __be32 *p;
1252 1252
1253 RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data)); 1253 RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data));
1254 WRITE32(OP_SETCLIENTID_CONFIRM); 1254 WRITE32(OP_SETCLIENTID_CONFIRM);
@@ -1260,7 +1260,7 @@ static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_c
1260 1260
1261static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) 1261static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args)
1262{ 1262{
1263 uint32_t *p; 1263 __be32 *p;
1264 1264
1265 RESERVE_SPACE(4); 1265 RESERVE_SPACE(4);
1266 WRITE32(OP_WRITE); 1266 WRITE32(OP_WRITE);
@@ -1279,7 +1279,7 @@ static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args
1279 1279
1280static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid) 1280static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid)
1281{ 1281{
1282 uint32_t *p; 1282 __be32 *p;
1283 1283
1284 RESERVE_SPACE(20); 1284 RESERVE_SPACE(20);
1285 1285
@@ -1295,7 +1295,7 @@ static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *statei
1295/* 1295/*
1296 * Encode an ACCESS request 1296 * Encode an ACCESS request
1297 */ 1297 */
1298static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct nfs4_accessargs *args) 1298static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs4_accessargs *args)
1299{ 1299{
1300 struct xdr_stream xdr; 1300 struct xdr_stream xdr;
1301 struct compound_hdr hdr = { 1301 struct compound_hdr hdr = {
@@ -1313,7 +1313,7 @@ static int nfs4_xdr_enc_access(struct rpc_rqst *req, uint32_t *p, const struct n
1313/* 1313/*
1314 * Encode LOOKUP request 1314 * Encode LOOKUP request
1315 */ 1315 */
1316static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_arg *args) 1316static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_arg *args)
1317{ 1317{
1318 struct xdr_stream xdr; 1318 struct xdr_stream xdr;
1319 struct compound_hdr hdr = { 1319 struct compound_hdr hdr = {
@@ -1337,7 +1337,7 @@ out:
1337/* 1337/*
1338 * Encode LOOKUP_ROOT request 1338 * Encode LOOKUP_ROOT request
1339 */ 1339 */
1340static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, uint32_t *p, const struct nfs4_lookup_root_arg *args) 1340static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_root_arg *args)
1341{ 1341{
1342 struct xdr_stream xdr; 1342 struct xdr_stream xdr;
1343 struct compound_hdr hdr = { 1343 struct compound_hdr hdr = {
@@ -1358,7 +1358,7 @@ out:
1358/* 1358/*
1359 * Encode REMOVE request 1359 * Encode REMOVE request
1360 */ 1360 */
1361static int nfs4_xdr_enc_remove(struct rpc_rqst *req, uint32_t *p, const struct nfs4_remove_arg *args) 1361static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs4_remove_arg *args)
1362{ 1362{
1363 struct xdr_stream xdr; 1363 struct xdr_stream xdr;
1364 struct compound_hdr hdr = { 1364 struct compound_hdr hdr = {
@@ -1380,7 +1380,7 @@ out:
1380/* 1380/*
1381 * Encode RENAME request 1381 * Encode RENAME request
1382 */ 1382 */
1383static int nfs4_xdr_enc_rename(struct rpc_rqst *req, uint32_t *p, const struct nfs4_rename_arg *args) 1383static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs4_rename_arg *args)
1384{ 1384{
1385 struct xdr_stream xdr; 1385 struct xdr_stream xdr;
1386 struct compound_hdr hdr = { 1386 struct compound_hdr hdr = {
@@ -1410,7 +1410,7 @@ out:
1410/* 1410/*
1411 * Encode LINK request 1411 * Encode LINK request
1412 */ 1412 */
1413static int nfs4_xdr_enc_link(struct rpc_rqst *req, uint32_t *p, const struct nfs4_link_arg *args) 1413static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_link_arg *args)
1414{ 1414{
1415 struct xdr_stream xdr; 1415 struct xdr_stream xdr;
1416 struct compound_hdr hdr = { 1416 struct compound_hdr hdr = {
@@ -1440,7 +1440,7 @@ out:
1440/* 1440/*
1441 * Encode CREATE request 1441 * Encode CREATE request
1442 */ 1442 */
1443static int nfs4_xdr_enc_create(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) 1443static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args)
1444{ 1444{
1445 struct xdr_stream xdr; 1445 struct xdr_stream xdr;
1446 struct compound_hdr hdr = { 1446 struct compound_hdr hdr = {
@@ -1470,7 +1470,7 @@ out:
1470/* 1470/*
1471 * Encode SYMLINK request 1471 * Encode SYMLINK request
1472 */ 1472 */
1473static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_create_arg *args) 1473static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args)
1474{ 1474{
1475 return nfs4_xdr_enc_create(req, p, args); 1475 return nfs4_xdr_enc_create(req, p, args);
1476} 1476}
@@ -1478,7 +1478,7 @@ static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, uint32_t *p, const struct
1478/* 1478/*
1479 * Encode GETATTR request 1479 * Encode GETATTR request
1480 */ 1480 */
1481static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct nfs4_getattr_arg *args) 1481static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nfs4_getattr_arg *args)
1482{ 1482{
1483 struct xdr_stream xdr; 1483 struct xdr_stream xdr;
1484 struct compound_hdr hdr = { 1484 struct compound_hdr hdr = {
@@ -1496,7 +1496,7 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, uint32_t *p, const struct
1496/* 1496/*
1497 * Encode a CLOSE request 1497 * Encode a CLOSE request
1498 */ 1498 */
1499static int nfs4_xdr_enc_close(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) 1499static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args)
1500{ 1500{
1501 struct xdr_stream xdr; 1501 struct xdr_stream xdr;
1502 struct compound_hdr hdr = { 1502 struct compound_hdr hdr = {
@@ -1520,7 +1520,7 @@ out:
1520/* 1520/*
1521 * Encode an OPEN request 1521 * Encode an OPEN request
1522 */ 1522 */
1523static int nfs4_xdr_enc_open(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) 1523static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args)
1524{ 1524{
1525 struct xdr_stream xdr; 1525 struct xdr_stream xdr;
1526 struct compound_hdr hdr = { 1526 struct compound_hdr hdr = {
@@ -1556,7 +1556,7 @@ out:
1556/* 1556/*
1557 * Encode an OPEN_CONFIRM request 1557 * Encode an OPEN_CONFIRM request
1558 */ 1558 */
1559static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_open_confirmargs *args) 1559static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_open_confirmargs *args)
1560{ 1560{
1561 struct xdr_stream xdr; 1561 struct xdr_stream xdr;
1562 struct compound_hdr hdr = { 1562 struct compound_hdr hdr = {
@@ -1577,7 +1577,7 @@ out:
1577/* 1577/*
1578 * Encode an OPEN request with no attributes. 1578 * Encode an OPEN request with no attributes.
1579 */ 1579 */
1580static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, uint32_t *p, struct nfs_openargs *args) 1580static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args)
1581{ 1581{
1582 struct xdr_stream xdr; 1582 struct xdr_stream xdr;
1583 struct compound_hdr hdr = { 1583 struct compound_hdr hdr = {
@@ -1601,7 +1601,7 @@ out:
1601/* 1601/*
1602 * Encode an OPEN_DOWNGRADE request 1602 * Encode an OPEN_DOWNGRADE request
1603 */ 1603 */
1604static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, uint32_t *p, struct nfs_closeargs *args) 1604static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args)
1605{ 1605{
1606 struct xdr_stream xdr; 1606 struct xdr_stream xdr;
1607 struct compound_hdr hdr = { 1607 struct compound_hdr hdr = {
@@ -1625,7 +1625,7 @@ out:
1625/* 1625/*
1626 * Encode a LOCK request 1626 * Encode a LOCK request
1627 */ 1627 */
1628static int nfs4_xdr_enc_lock(struct rpc_rqst *req, uint32_t *p, struct nfs_lock_args *args) 1628static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_args *args)
1629{ 1629{
1630 struct xdr_stream xdr; 1630 struct xdr_stream xdr;
1631 struct compound_hdr hdr = { 1631 struct compound_hdr hdr = {
@@ -1646,7 +1646,7 @@ out:
1646/* 1646/*
1647 * Encode a LOCKT request 1647 * Encode a LOCKT request
1648 */ 1648 */
1649static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, uint32_t *p, struct nfs_lockt_args *args) 1649static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_args *args)
1650{ 1650{
1651 struct xdr_stream xdr; 1651 struct xdr_stream xdr;
1652 struct compound_hdr hdr = { 1652 struct compound_hdr hdr = {
@@ -1667,7 +1667,7 @@ out:
1667/* 1667/*
1668 * Encode a LOCKU request 1668 * Encode a LOCKU request
1669 */ 1669 */
1670static int nfs4_xdr_enc_locku(struct rpc_rqst *req, uint32_t *p, struct nfs_locku_args *args) 1670static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_args *args)
1671{ 1671{
1672 struct xdr_stream xdr; 1672 struct xdr_stream xdr;
1673 struct compound_hdr hdr = { 1673 struct compound_hdr hdr = {
@@ -1688,7 +1688,7 @@ out:
1688/* 1688/*
1689 * Encode a READLINK request 1689 * Encode a READLINK request
1690 */ 1690 */
1691static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readlink *args) 1691static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_readlink *args)
1692{ 1692{
1693 struct xdr_stream xdr; 1693 struct xdr_stream xdr;
1694 struct compound_hdr hdr = { 1694 struct compound_hdr hdr = {
@@ -1709,7 +1709,7 @@ out:
1709/* 1709/*
1710 * Encode a READDIR request 1710 * Encode a READDIR request
1711 */ 1711 */
1712static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, uint32_t *p, const struct nfs4_readdir_arg *args) 1712static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nfs4_readdir_arg *args)
1713{ 1713{
1714 struct xdr_stream xdr; 1714 struct xdr_stream xdr;
1715 struct compound_hdr hdr = { 1715 struct compound_hdr hdr = {
@@ -1730,7 +1730,7 @@ out:
1730/* 1730/*
1731 * Encode a READ request 1731 * Encode a READ request
1732 */ 1732 */
1733static int nfs4_xdr_enc_read(struct rpc_rqst *req, uint32_t *p, struct nfs_readargs *args) 1733static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
1734{ 1734{
1735 struct rpc_auth *auth = req->rq_task->tk_auth; 1735 struct rpc_auth *auth = req->rq_task->tk_auth;
1736 struct xdr_stream xdr; 1736 struct xdr_stream xdr;
@@ -1762,7 +1762,7 @@ out:
1762/* 1762/*
1763 * Encode an SETATTR request 1763 * Encode an SETATTR request
1764 */ 1764 */
1765static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, uint32_t *p, struct nfs_setattrargs *args) 1765static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args)
1766 1766
1767{ 1767{
1768 struct xdr_stream xdr; 1768 struct xdr_stream xdr;
@@ -1788,7 +1788,7 @@ out:
1788 * Encode a GETACL request 1788 * Encode a GETACL request
1789 */ 1789 */
1790static int 1790static int
1791nfs4_xdr_enc_getacl(struct rpc_rqst *req, uint32_t *p, 1791nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
1792 struct nfs_getaclargs *args) 1792 struct nfs_getaclargs *args)
1793{ 1793{
1794 struct xdr_stream xdr; 1794 struct xdr_stream xdr;
@@ -1815,7 +1815,7 @@ out:
1815/* 1815/*
1816 * Encode a WRITE request 1816 * Encode a WRITE request
1817 */ 1817 */
1818static int nfs4_xdr_enc_write(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) 1818static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
1819{ 1819{
1820 struct xdr_stream xdr; 1820 struct xdr_stream xdr;
1821 struct compound_hdr hdr = { 1821 struct compound_hdr hdr = {
@@ -1839,7 +1839,7 @@ out:
1839/* 1839/*
1840 * a COMMIT request 1840 * a COMMIT request
1841 */ 1841 */
1842static int nfs4_xdr_enc_commit(struct rpc_rqst *req, uint32_t *p, struct nfs_writeargs *args) 1842static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
1843{ 1843{
1844 struct xdr_stream xdr; 1844 struct xdr_stream xdr;
1845 struct compound_hdr hdr = { 1845 struct compound_hdr hdr = {
@@ -1863,7 +1863,7 @@ out:
1863/* 1863/*
1864 * FSINFO request 1864 * FSINFO request
1865 */ 1865 */
1866static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fsinfo_arg *args) 1866static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args)
1867{ 1867{
1868 struct xdr_stream xdr; 1868 struct xdr_stream xdr;
1869 struct compound_hdr hdr = { 1869 struct compound_hdr hdr = {
@@ -1882,7 +1882,7 @@ static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs
1882/* 1882/*
1883 * a PATHCONF request 1883 * a PATHCONF request
1884 */ 1884 */
1885static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct nfs4_pathconf_arg *args) 1885static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct nfs4_pathconf_arg *args)
1886{ 1886{
1887 struct xdr_stream xdr; 1887 struct xdr_stream xdr;
1888 struct compound_hdr hdr = { 1888 struct compound_hdr hdr = {
@@ -1902,7 +1902,7 @@ static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, uint32_t *p, const struct
1902/* 1902/*
1903 * a STATFS request 1903 * a STATFS request
1904 */ 1904 */
1905static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct nfs4_statfs_arg *args) 1905static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs4_statfs_arg *args)
1906{ 1906{
1907 struct xdr_stream xdr; 1907 struct xdr_stream xdr;
1908 struct compound_hdr hdr = { 1908 struct compound_hdr hdr = {
@@ -1923,7 +1923,7 @@ static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, uint32_t *p, const struct n
1923/* 1923/*
1924 * GETATTR_BITMAP request 1924 * GETATTR_BITMAP request
1925 */ 1925 */
1926static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const struct nfs_fh *fhandle) 1926static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p, const struct nfs_fh *fhandle)
1927{ 1927{
1928 struct xdr_stream xdr; 1928 struct xdr_stream xdr;
1929 struct compound_hdr hdr = { 1929 struct compound_hdr hdr = {
@@ -1945,7 +1945,7 @@ static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, uint32_t *p, const str
1945/* 1945/*
1946 * a RENEW request 1946 * a RENEW request
1947 */ 1947 */
1948static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) 1948static int nfs4_xdr_enc_renew(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp)
1949{ 1949{
1950 struct xdr_stream xdr; 1950 struct xdr_stream xdr;
1951 struct compound_hdr hdr = { 1951 struct compound_hdr hdr = {
@@ -1960,7 +1960,7 @@ static int nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs_clie
1960/* 1960/*
1961 * a SETCLIENTID request 1961 * a SETCLIENTID request
1962 */ 1962 */
1963static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nfs4_setclientid *sc) 1963static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid *sc)
1964{ 1964{
1965 struct xdr_stream xdr; 1965 struct xdr_stream xdr;
1966 struct compound_hdr hdr = { 1966 struct compound_hdr hdr = {
@@ -1975,7 +1975,7 @@ static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, uint32_t *p, struct nf
1975/* 1975/*
1976 * a SETCLIENTID_CONFIRM request 1976 * a SETCLIENTID_CONFIRM request
1977 */ 1977 */
1978static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_client *clp) 1978static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp)
1979{ 1979{
1980 struct xdr_stream xdr; 1980 struct xdr_stream xdr;
1981 struct compound_hdr hdr = { 1981 struct compound_hdr hdr = {
@@ -1997,7 +1997,7 @@ static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s
1997/* 1997/*
1998 * DELEGRETURN request 1998 * DELEGRETURN request
1999 */ 1999 */
2000static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, uint32_t *p, const struct nfs4_delegreturnargs *args) 2000static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struct nfs4_delegreturnargs *args)
2001{ 2001{
2002 struct xdr_stream xdr; 2002 struct xdr_stream xdr;
2003 struct compound_hdr hdr = { 2003 struct compound_hdr hdr = {
@@ -2021,7 +2021,7 @@ out:
2021/* 2021/*
2022 * Encode FS_LOCATIONS request 2022 * Encode FS_LOCATIONS request
2023 */ 2023 */
2024static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations_arg *args) 2024static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations_arg *args)
2025{ 2025{
2026 struct xdr_stream xdr; 2026 struct xdr_stream xdr;
2027 struct compound_hdr hdr = { 2027 struct compound_hdr hdr = {
@@ -2086,7 +2086,7 @@ out:
2086 2086
2087static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string) 2087static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string)
2088{ 2088{
2089 uint32_t *p; 2089 __be32 *p;
2090 2090
2091 READ_BUF(4); 2091 READ_BUF(4);
2092 READ32(*len); 2092 READ32(*len);
@@ -2097,7 +2097,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char
2097 2097
2098static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) 2098static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
2099{ 2099{
2100 uint32_t *p; 2100 __be32 *p;
2101 2101
2102 READ_BUF(8); 2102 READ_BUF(8);
2103 READ32(hdr->status); 2103 READ32(hdr->status);
@@ -2112,7 +2112,7 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
2112 2112
2113static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) 2113static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2114{ 2114{
2115 uint32_t *p; 2115 __be32 *p;
2116 uint32_t opnum; 2116 uint32_t opnum;
2117 int32_t nfserr; 2117 int32_t nfserr;
2118 2118
@@ -2134,7 +2134,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
2134/* Dummy routine */ 2134/* Dummy routine */
2135static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp) 2135static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp)
2136{ 2136{
2137 uint32_t *p; 2137 __be32 *p;
2138 unsigned int strlen; 2138 unsigned int strlen;
2139 char *str; 2139 char *str;
2140 2140
@@ -2144,7 +2144,8 @@ static int decode_ace(struct xdr_stream *xdr, void *ace, struct nfs_client *clp)
2144 2144
2145static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 2145static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
2146{ 2146{
2147 uint32_t bmlen, *p; 2147 uint32_t bmlen;
2148 __be32 *p;
2148 2149
2149 READ_BUF(4); 2150 READ_BUF(4);
2150 READ32(bmlen); 2151 READ32(bmlen);
@@ -2159,9 +2160,9 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
2159 return 0; 2160 return 0;
2160} 2161}
2161 2162
2162static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, uint32_t **savep) 2163static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, __be32 **savep)
2163{ 2164{
2164 uint32_t *p; 2165 __be32 *p;
2165 2166
2166 READ_BUF(4); 2167 READ_BUF(4);
2167 READ32(*attrlen); 2168 READ32(*attrlen);
@@ -2182,7 +2183,7 @@ static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint3
2182 2183
2183static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) 2184static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type)
2184{ 2185{
2185 uint32_t *p; 2186 __be32 *p;
2186 2187
2187 *type = 0; 2188 *type = 0;
2188 if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) 2189 if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U)))
@@ -2202,7 +2203,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2202 2203
2203static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) 2204static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change)
2204{ 2205{
2205 uint32_t *p; 2206 __be32 *p;
2206 2207
2207 *change = 0; 2208 *change = 0;
2208 if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) 2209 if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U)))
@@ -2219,7 +2220,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2219 2220
2220static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) 2221static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size)
2221{ 2222{
2222 uint32_t *p; 2223 __be32 *p;
2223 2224
2224 *size = 0; 2225 *size = 0;
2225 if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) 2226 if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U)))
@@ -2235,7 +2236,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *
2235 2236
2236static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2237static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2237{ 2238{
2238 uint32_t *p; 2239 __be32 *p;
2239 2240
2240 *res = 0; 2241 *res = 0;
2241 if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) 2242 if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U)))
@@ -2251,7 +2252,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
2251 2252
2252static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2253static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2253{ 2254{
2254 uint32_t *p; 2255 __be32 *p;
2255 2256
2256 *res = 0; 2257 *res = 0;
2257 if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U))) 2258 if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U)))
@@ -2267,7 +2268,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
2267 2268
2268static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) 2269static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid)
2269{ 2270{
2270 uint32_t *p; 2271 __be32 *p;
2271 2272
2272 fsid->major = 0; 2273 fsid->major = 0;
2273 fsid->minor = 0; 2274 fsid->minor = 0;
@@ -2287,7 +2288,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
2287 2288
2288static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2289static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2289{ 2290{
2290 uint32_t *p; 2291 __be32 *p;
2291 2292
2292 *res = 60; 2293 *res = 60;
2293 if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) 2294 if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U)))
@@ -2303,7 +2304,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
2303 2304
2304static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2305static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2305{ 2306{
2306 uint32_t *p; 2307 __be32 *p;
2307 2308
2308 *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL; 2309 *res = ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL;
2309 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U))) 2310 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U)))
@@ -2319,7 +2320,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
2319 2320
2320static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 2321static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
2321{ 2322{
2322 uint32_t *p; 2323 __be32 *p;
2323 2324
2324 *fileid = 0; 2325 *fileid = 0;
2325 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) 2326 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U)))
@@ -2335,7 +2336,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
2335 2336
2336static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 2337static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
2337{ 2338{
2338 uint32_t *p; 2339 __be32 *p;
2339 2340
2340 *fileid = 0; 2341 *fileid = 0;
2341 if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) 2342 if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U)))
@@ -2351,7 +2352,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma
2351 2352
2352static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2353static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2353{ 2354{
2354 uint32_t *p; 2355 __be32 *p;
2355 int status = 0; 2356 int status = 0;
2356 2357
2357 *res = 0; 2358 *res = 0;
@@ -2368,7 +2369,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2368 2369
2369static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2370static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2370{ 2371{
2371 uint32_t *p; 2372 __be32 *p;
2372 int status = 0; 2373 int status = 0;
2373 2374
2374 *res = 0; 2375 *res = 0;
@@ -2385,7 +2386,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2385 2386
2386static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2387static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2387{ 2388{
2388 uint32_t *p; 2389 __be32 *p;
2389 int status = 0; 2390 int status = 0;
2390 2391
2391 *res = 0; 2392 *res = 0;
@@ -2403,7 +2404,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2403static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) 2404static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2404{ 2405{
2405 int n; 2406 int n;
2406 uint32_t *p; 2407 __be32 *p;
2407 int status = 0; 2408 int status = 0;
2408 2409
2409 READ_BUF(4); 2410 READ_BUF(4);
@@ -2448,7 +2449,7 @@ out_eio:
2448static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) 2449static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res)
2449{ 2450{
2450 int n; 2451 int n;
2451 uint32_t *p; 2452 __be32 *p;
2452 int status = -EIO; 2453 int status = -EIO;
2453 2454
2454 if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) 2455 if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U)))
@@ -2512,7 +2513,7 @@ out_eio:
2512 2513
2513static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2514static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2514{ 2515{
2515 uint32_t *p; 2516 __be32 *p;
2516 int status = 0; 2517 int status = 0;
2517 2518
2518 *res = 0; 2519 *res = 0;
@@ -2529,7 +2530,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin
2529 2530
2530static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) 2531static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink)
2531{ 2532{
2532 uint32_t *p; 2533 __be32 *p;
2533 int status = 0; 2534 int status = 0;
2534 2535
2535 *maxlink = 1; 2536 *maxlink = 1;
@@ -2546,7 +2547,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2546 2547
2547static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) 2548static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname)
2548{ 2549{
2549 uint32_t *p; 2550 __be32 *p;
2550 int status = 0; 2551 int status = 0;
2551 2552
2552 *maxname = 1024; 2553 *maxname = 1024;
@@ -2563,7 +2564,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2563 2564
2564static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2565static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2565{ 2566{
2566 uint32_t *p; 2567 __be32 *p;
2567 int status = 0; 2568 int status = 0;
2568 2569
2569 *res = 1024; 2570 *res = 1024;
@@ -2584,7 +2585,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
2584 2585
2585static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 2586static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
2586{ 2587{
2587 uint32_t *p; 2588 __be32 *p;
2588 int status = 0; 2589 int status = 0;
2589 2590
2590 *res = 1024; 2591 *res = 1024;
@@ -2605,7 +2606,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
2605 2606
2606static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode) 2607static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode)
2607{ 2608{
2608 uint32_t *p; 2609 __be32 *p;
2609 2610
2610 *mode = 0; 2611 *mode = 0;
2611 if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) 2612 if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U)))
@@ -2622,7 +2623,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
2622 2623
2623static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) 2624static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink)
2624{ 2625{
2625 uint32_t *p; 2626 __be32 *p;
2626 2627
2627 *nlink = 1; 2628 *nlink = 1;
2628 if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) 2629 if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U)))
@@ -2638,7 +2639,8 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
2638 2639
2639static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid) 2640static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid)
2640{ 2641{
2641 uint32_t len, *p; 2642 uint32_t len;
2643 __be32 *p;
2642 2644
2643 *uid = -2; 2645 *uid = -2;
2644 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) 2646 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U)))
@@ -2662,7 +2664,8 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2662 2664
2663static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid) 2665static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid)
2664{ 2666{
2665 uint32_t len, *p; 2667 uint32_t len;
2668 __be32 *p;
2666 2669
2667 *gid = -2; 2670 *gid = -2;
2668 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) 2671 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U)))
@@ -2686,7 +2689,8 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
2686 2689
2687static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) 2690static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev)
2688{ 2691{
2689 uint32_t major = 0, minor = 0, *p; 2692 uint32_t major = 0, minor = 0;
2693 __be32 *p;
2690 2694
2691 *rdev = MKDEV(0,0); 2695 *rdev = MKDEV(0,0);
2692 if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) 2696 if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U)))
@@ -2708,7 +2712,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
2708 2712
2709static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2713static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2710{ 2714{
2711 uint32_t *p; 2715 __be32 *p;
2712 int status = 0; 2716 int status = 0;
2713 2717
2714 *res = 0; 2718 *res = 0;
@@ -2725,7 +2729,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
2725 2729
2726static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2730static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2727{ 2731{
2728 uint32_t *p; 2732 __be32 *p;
2729 int status = 0; 2733 int status = 0;
2730 2734
2731 *res = 0; 2735 *res = 0;
@@ -2742,7 +2746,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
2742 2746
2743static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 2747static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
2744{ 2748{
2745 uint32_t *p; 2749 __be32 *p;
2746 int status = 0; 2750 int status = 0;
2747 2751
2748 *res = 0; 2752 *res = 0;
@@ -2759,7 +2763,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2759 2763
2760static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) 2764static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used)
2761{ 2765{
2762 uint32_t *p; 2766 __be32 *p;
2763 2767
2764 *used = 0; 2768 *used = 0;
2765 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) 2769 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U)))
@@ -2776,7 +2780,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
2776 2780
2777static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) 2781static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)
2778{ 2782{
2779 uint32_t *p; 2783 __be32 *p;
2780 uint64_t sec; 2784 uint64_t sec;
2781 uint32_t nsec; 2785 uint32_t nsec;
2782 2786
@@ -2836,7 +2840,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str
2836 return status; 2840 return status;
2837} 2841}
2838 2842
2839static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t attrlen) 2843static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrlen)
2840{ 2844{
2841 unsigned int attrwords = XDR_QUADLEN(attrlen); 2845 unsigned int attrwords = XDR_QUADLEN(attrlen);
2842 unsigned int nwords = xdr->p - savep; 2846 unsigned int nwords = xdr->p - savep;
@@ -2854,7 +2858,7 @@ static int verify_attr_len(struct xdr_stream *xdr, uint32_t *savep, uint32_t att
2854 2858
2855static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 2859static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2856{ 2860{
2857 uint32_t *p; 2861 __be32 *p;
2858 2862
2859 READ_BUF(20); 2863 READ_BUF(20);
2860 READ32(cinfo->atomic); 2864 READ32(cinfo->atomic);
@@ -2865,7 +2869,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c
2865 2869
2866static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) 2870static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
2867{ 2871{
2868 uint32_t *p; 2872 __be32 *p;
2869 uint32_t supp, acc; 2873 uint32_t supp, acc;
2870 int status; 2874 int status;
2871 2875
@@ -2882,7 +2886,7 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
2882 2886
2883static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) 2887static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
2884{ 2888{
2885 uint32_t *p; 2889 __be32 *p;
2886 int status; 2890 int status;
2887 2891
2888 status = decode_op_hdr(xdr, OP_CLOSE); 2892 status = decode_op_hdr(xdr, OP_CLOSE);
@@ -2895,7 +2899,7 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
2895 2899
2896static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) 2900static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
2897{ 2901{
2898 uint32_t *p; 2902 __be32 *p;
2899 int status; 2903 int status;
2900 2904
2901 status = decode_op_hdr(xdr, OP_COMMIT); 2905 status = decode_op_hdr(xdr, OP_COMMIT);
@@ -2908,7 +2912,7 @@ static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res)
2908 2912
2909static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 2913static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2910{ 2914{
2911 uint32_t *p; 2915 __be32 *p;
2912 uint32_t bmlen; 2916 uint32_t bmlen;
2913 int status; 2917 int status;
2914 2918
@@ -2925,7 +2929,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
2925 2929
2926static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) 2930static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res)
2927{ 2931{
2928 uint32_t *savep; 2932 __be32 *savep;
2929 uint32_t attrlen, 2933 uint32_t attrlen,
2930 bitmap[2] = {0}; 2934 bitmap[2] = {0};
2931 int status; 2935 int status;
@@ -2952,7 +2956,7 @@ xdr_error:
2952 2956
2953static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) 2957static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat)
2954{ 2958{
2955 uint32_t *savep; 2959 __be32 *savep;
2956 uint32_t attrlen, 2960 uint32_t attrlen,
2957 bitmap[2] = {0}; 2961 bitmap[2] = {0};
2958 int status; 2962 int status;
@@ -2985,7 +2989,7 @@ xdr_error:
2985 2989
2986static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) 2990static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf)
2987{ 2991{
2988 uint32_t *savep; 2992 __be32 *savep;
2989 uint32_t attrlen, 2993 uint32_t attrlen,
2990 bitmap[2] = {0}; 2994 bitmap[2] = {0};
2991 int status; 2995 int status;
@@ -3010,7 +3014,7 @@ xdr_error:
3010 3014
3011static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server) 3015static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server)
3012{ 3016{
3013 uint32_t *savep; 3017 __be32 *savep;
3014 uint32_t attrlen, 3018 uint32_t attrlen,
3015 bitmap[2] = {0}, 3019 bitmap[2] = {0},
3016 type; 3020 type;
@@ -3079,7 +3083,7 @@ xdr_error:
3079 3083
3080static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) 3084static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
3081{ 3085{
3082 uint32_t *savep; 3086 __be32 *savep;
3083 uint32_t attrlen, bitmap[2]; 3087 uint32_t attrlen, bitmap[2];
3084 int status; 3088 int status;
3085 3089
@@ -3111,7 +3115,7 @@ xdr_error:
3111 3115
3112static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) 3116static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
3113{ 3117{
3114 uint32_t *p; 3118 __be32 *p;
3115 uint32_t len; 3119 uint32_t len;
3116 int status; 3120 int status;
3117 3121
@@ -3147,7 +3151,7 @@ static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
3147static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) 3151static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3148{ 3152{
3149 uint64_t offset, length, clientid; 3153 uint64_t offset, length, clientid;
3150 uint32_t *p; 3154 __be32 *p;
3151 uint32_t namelen, type; 3155 uint32_t namelen, type;
3152 3156
3153 READ_BUF(32); 3157 READ_BUF(32);
@@ -3172,7 +3176,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
3172 3176
3173static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) 3177static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res)
3174{ 3178{
3175 uint32_t *p; 3179 __be32 *p;
3176 int status; 3180 int status;
3177 3181
3178 status = decode_op_hdr(xdr, OP_LOCK); 3182 status = decode_op_hdr(xdr, OP_LOCK);
@@ -3195,7 +3199,7 @@ static int decode_lockt(struct xdr_stream *xdr, struct nfs_lockt_res *res)
3195 3199
3196static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) 3200static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res)
3197{ 3201{
3198 uint32_t *p; 3202 __be32 *p;
3199 int status; 3203 int status;
3200 3204
3201 status = decode_op_hdr(xdr, OP_LOCKU); 3205 status = decode_op_hdr(xdr, OP_LOCKU);
@@ -3214,7 +3218,7 @@ static int decode_lookup(struct xdr_stream *xdr)
3214/* This is too sick! */ 3218/* This is too sick! */
3215static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) 3219static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
3216{ 3220{
3217 uint32_t *p; 3221 __be32 *p;
3218 uint32_t limit_type, nblocks, blocksize; 3222 uint32_t limit_type, nblocks, blocksize;
3219 3223
3220 READ_BUF(12); 3224 READ_BUF(12);
@@ -3233,7 +3237,7 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
3233 3237
3234static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) 3238static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
3235{ 3239{
3236 uint32_t *p; 3240 __be32 *p;
3237 uint32_t delegation_type; 3241 uint32_t delegation_type;
3238 3242
3239 READ_BUF(4); 3243 READ_BUF(4);
@@ -3259,7 +3263,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
3259 3263
3260static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) 3264static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
3261{ 3265{
3262 uint32_t *p; 3266 __be32 *p;
3263 uint32_t bmlen; 3267 uint32_t bmlen;
3264 int status; 3268 int status;
3265 3269
@@ -3287,7 +3291,7 @@ xdr_error:
3287 3291
3288static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) 3292static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res)
3289{ 3293{
3290 uint32_t *p; 3294 __be32 *p;
3291 int status; 3295 int status;
3292 3296
3293 status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); 3297 status = decode_op_hdr(xdr, OP_OPEN_CONFIRM);
@@ -3300,7 +3304,7 @@ static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmre
3300 3304
3301static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) 3305static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res)
3302{ 3306{
3303 uint32_t *p; 3307 __be32 *p;
3304 int status; 3308 int status;
3305 3309
3306 status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); 3310 status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE);
@@ -3324,7 +3328,7 @@ static int decode_putrootfh(struct xdr_stream *xdr)
3324static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res) 3328static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res)
3325{ 3329{
3326 struct kvec *iov = req->rq_rcv_buf.head; 3330 struct kvec *iov = req->rq_rcv_buf.head;
3327 uint32_t *p; 3331 __be32 *p;
3328 uint32_t count, eof, recvd, hdrlen; 3332 uint32_t count, eof, recvd, hdrlen;
3329 int status; 3333 int status;
3330 3334
@@ -3354,7 +3358,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3354 struct page *page = *rcvbuf->pages; 3358 struct page *page = *rcvbuf->pages;
3355 struct kvec *iov = rcvbuf->head; 3359 struct kvec *iov = rcvbuf->head;
3356 unsigned int nr, pglen = rcvbuf->page_len; 3360 unsigned int nr, pglen = rcvbuf->page_len;
3357 uint32_t *end, *entry, *p, *kaddr; 3361 __be32 *end, *entry, *p, *kaddr;
3358 uint32_t len, attrlen, xlen; 3362 uint32_t len, attrlen, xlen;
3359 int hdrlen, recvd, status; 3363 int hdrlen, recvd, status;
3360 3364
@@ -3376,7 +3380,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3376 xdr_read_pages(xdr, pglen); 3380 xdr_read_pages(xdr, pglen);
3377 3381
3378 BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE); 3382 BUG_ON(pglen + readdir->pgbase > PAGE_CACHE_SIZE);
3379 kaddr = p = (uint32_t *) kmap_atomic(page, KM_USER0); 3383 kaddr = p = kmap_atomic(page, KM_USER0);
3380 end = p + ((pglen + readdir->pgbase) >> 2); 3384 end = p + ((pglen + readdir->pgbase) >> 2);
3381 entry = p; 3385 entry = p;
3382 for (nr = 0; *p++; nr++) { 3386 for (nr = 0; *p++; nr++) {
@@ -3428,7 +3432,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
3428 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 3432 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
3429 struct kvec *iov = rcvbuf->head; 3433 struct kvec *iov = rcvbuf->head;
3430 int hdrlen, len, recvd; 3434 int hdrlen, len, recvd;
3431 uint32_t *p; 3435 __be32 *p;
3432 char *kaddr; 3436 char *kaddr;
3433 int status; 3437 int status;
3434 3438
@@ -3505,7 +3509,7 @@ decode_restorefh(struct xdr_stream *xdr)
3505static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, 3509static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
3506 size_t *acl_len) 3510 size_t *acl_len)
3507{ 3511{
3508 uint32_t *savep; 3512 __be32 *savep;
3509 uint32_t attrlen, 3513 uint32_t attrlen,
3510 bitmap[2] = {0}; 3514 bitmap[2] = {0};
3511 struct kvec *iov = req->rq_rcv_buf.head; 3515 struct kvec *iov = req->rq_rcv_buf.head;
@@ -3551,7 +3555,7 @@ decode_savefh(struct xdr_stream *xdr)
3551 3555
3552static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) 3556static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res)
3553{ 3557{
3554 uint32_t *p; 3558 __be32 *p;
3555 uint32_t bmlen; 3559 uint32_t bmlen;
3556 int status; 3560 int status;
3557 3561
@@ -3567,7 +3571,7 @@ static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res)
3567 3571
3568static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) 3572static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
3569{ 3573{
3570 uint32_t *p; 3574 __be32 *p;
3571 uint32_t opnum; 3575 uint32_t opnum;
3572 int32_t nfserr; 3576 int32_t nfserr;
3573 3577
@@ -3610,7 +3614,7 @@ static int decode_setclientid_confirm(struct xdr_stream *xdr)
3610 3614
3611static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res) 3615static int decode_write(struct xdr_stream *xdr, struct nfs_writeres *res)
3612{ 3616{
3613 uint32_t *p; 3617 __be32 *p;
3614 int status; 3618 int status;
3615 3619
3616 status = decode_op_hdr(xdr, OP_WRITE); 3620 status = decode_op_hdr(xdr, OP_WRITE);
@@ -3632,7 +3636,7 @@ static int decode_delegreturn(struct xdr_stream *xdr)
3632/* 3636/*
3633 * Decode OPEN_DOWNGRADE response 3637 * Decode OPEN_DOWNGRADE response
3634 */ 3638 */
3635static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) 3639static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res)
3636{ 3640{
3637 struct xdr_stream xdr; 3641 struct xdr_stream xdr;
3638 struct compound_hdr hdr; 3642 struct compound_hdr hdr;
@@ -3660,7 +3664,7 @@ out:
3660/* 3664/*
3661 * Decode ACCESS response 3665 * Decode ACCESS response
3662 */ 3666 */
3663static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_accessres *res) 3667static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res)
3664{ 3668{
3665 struct xdr_stream xdr; 3669 struct xdr_stream xdr;
3666 struct compound_hdr hdr; 3670 struct compound_hdr hdr;
@@ -3678,7 +3682,7 @@ out:
3678/* 3682/*
3679 * Decode LOOKUP response 3683 * Decode LOOKUP response
3680 */ 3684 */
3681static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) 3685static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res)
3682{ 3686{
3683 struct xdr_stream xdr; 3687 struct xdr_stream xdr;
3684 struct compound_hdr hdr; 3688 struct compound_hdr hdr;
@@ -3701,7 +3705,7 @@ out:
3701/* 3705/*
3702 * Decode LOOKUP_ROOT response 3706 * Decode LOOKUP_ROOT response
3703 */ 3707 */
3704static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_lookup_res *res) 3708static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res)
3705{ 3709{
3706 struct xdr_stream xdr; 3710 struct xdr_stream xdr;
3707 struct compound_hdr hdr; 3711 struct compound_hdr hdr;
@@ -3721,7 +3725,7 @@ out:
3721/* 3725/*
3722 * Decode REMOVE response 3726 * Decode REMOVE response
3723 */ 3727 */
3724static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_remove_res *res) 3728static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_remove_res *res)
3725{ 3729{
3726 struct xdr_stream xdr; 3730 struct xdr_stream xdr;
3727 struct compound_hdr hdr; 3731 struct compound_hdr hdr;
@@ -3742,7 +3746,7 @@ out:
3742/* 3746/*
3743 * Decode RENAME response 3747 * Decode RENAME response
3744 */ 3748 */
3745static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_rename_res *res) 3749static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_rename_res *res)
3746{ 3750{
3747 struct xdr_stream xdr; 3751 struct xdr_stream xdr;
3748 struct compound_hdr hdr; 3752 struct compound_hdr hdr;
@@ -3772,7 +3776,7 @@ out:
3772/* 3776/*
3773 * Decode LINK response 3777 * Decode LINK response
3774 */ 3778 */
3775static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_link_res *res) 3779static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link_res *res)
3776{ 3780{
3777 struct xdr_stream xdr; 3781 struct xdr_stream xdr;
3778 struct compound_hdr hdr; 3782 struct compound_hdr hdr;
@@ -3805,7 +3809,7 @@ out:
3805/* 3809/*
3806 * Decode CREATE response 3810 * Decode CREATE response
3807 */ 3811 */
3808static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) 3812static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res)
3809{ 3813{
3810 struct xdr_stream xdr; 3814 struct xdr_stream xdr;
3811 struct compound_hdr hdr; 3815 struct compound_hdr hdr;
@@ -3834,7 +3838,7 @@ out:
3834/* 3838/*
3835 * Decode SYMLINK response 3839 * Decode SYMLINK response
3836 */ 3840 */
3837static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_create_res *res) 3841static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res)
3838{ 3842{
3839 return nfs4_xdr_dec_create(rqstp, p, res); 3843 return nfs4_xdr_dec_create(rqstp, p, res);
3840} 3844}
@@ -3842,7 +3846,7 @@ static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4
3842/* 3846/*
3843 * Decode GETATTR response 3847 * Decode GETATTR response
3844 */ 3848 */
3845static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_getattr_res *res) 3849static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_getattr_res *res)
3846{ 3850{
3847 struct xdr_stream xdr; 3851 struct xdr_stream xdr;
3848 struct compound_hdr hdr; 3852 struct compound_hdr hdr;
@@ -3865,7 +3869,7 @@ out:
3865 * Encode an SETACL request 3869 * Encode an SETACL request
3866 */ 3870 */
3867static int 3871static int
3868nfs4_xdr_enc_setacl(struct rpc_rqst *req, uint32_t *p, struct nfs_setaclargs *args) 3872nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args)
3869{ 3873{
3870 struct xdr_stream xdr; 3874 struct xdr_stream xdr;
3871 struct compound_hdr hdr = { 3875 struct compound_hdr hdr = {
@@ -3886,7 +3890,7 @@ out:
3886 * Decode SETACL response 3890 * Decode SETACL response
3887 */ 3891 */
3888static int 3892static int
3889nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, uint32_t *p, void *res) 3893nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, __be32 *p, void *res)
3890{ 3894{
3891 struct xdr_stream xdr; 3895 struct xdr_stream xdr;
3892 struct compound_hdr hdr; 3896 struct compound_hdr hdr;
@@ -3908,7 +3912,7 @@ out:
3908 * Decode GETACL response 3912 * Decode GETACL response
3909 */ 3913 */
3910static int 3914static int
3911nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, uint32_t *p, size_t *acl_len) 3915nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, size_t *acl_len)
3912{ 3916{
3913 struct xdr_stream xdr; 3917 struct xdr_stream xdr;
3914 struct compound_hdr hdr; 3918 struct compound_hdr hdr;
@@ -3930,7 +3934,7 @@ out:
3930/* 3934/*
3931 * Decode CLOSE response 3935 * Decode CLOSE response
3932 */ 3936 */
3933static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_closeres *res) 3937static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res)
3934{ 3938{
3935 struct xdr_stream xdr; 3939 struct xdr_stream xdr;
3936 struct compound_hdr hdr; 3940 struct compound_hdr hdr;
@@ -3960,7 +3964,7 @@ out:
3960/* 3964/*
3961 * Decode OPEN response 3965 * Decode OPEN response
3962 */ 3966 */
3963static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) 3967static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res)
3964{ 3968{
3965 struct xdr_stream xdr; 3969 struct xdr_stream xdr;
3966 struct compound_hdr hdr; 3970 struct compound_hdr hdr;
@@ -3994,7 +3998,7 @@ out:
3994/* 3998/*
3995 * Decode OPEN_CONFIRM response 3999 * Decode OPEN_CONFIRM response
3996 */ 4000 */
3997static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_open_confirmres *res) 4001static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res)
3998{ 4002{
3999 struct xdr_stream xdr; 4003 struct xdr_stream xdr;
4000 struct compound_hdr hdr; 4004 struct compound_hdr hdr;
@@ -4015,7 +4019,7 @@ out:
4015/* 4019/*
4016 * Decode OPEN response 4020 * Decode OPEN response
4017 */ 4021 */
4018static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_openres *res) 4022static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res)
4019{ 4023{
4020 struct xdr_stream xdr; 4024 struct xdr_stream xdr;
4021 struct compound_hdr hdr; 4025 struct compound_hdr hdr;
@@ -4039,7 +4043,7 @@ out:
4039/* 4043/*
4040 * Decode SETATTR response 4044 * Decode SETATTR response
4041 */ 4045 */
4042static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_setattrres *res) 4046static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res)
4043{ 4047{
4044 struct xdr_stream xdr; 4048 struct xdr_stream xdr;
4045 struct compound_hdr hdr; 4049 struct compound_hdr hdr;
@@ -4065,7 +4069,7 @@ out:
4065/* 4069/*
4066 * Decode LOCK response 4070 * Decode LOCK response
4067 */ 4071 */
4068static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lock_res *res) 4072static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lock_res *res)
4069{ 4073{
4070 struct xdr_stream xdr; 4074 struct xdr_stream xdr;
4071 struct compound_hdr hdr; 4075 struct compound_hdr hdr;
@@ -4086,7 +4090,7 @@ out:
4086/* 4090/*
4087 * Decode LOCKT response 4091 * Decode LOCKT response
4088 */ 4092 */
4089static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_lockt_res *res) 4093static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lockt_res *res)
4090{ 4094{
4091 struct xdr_stream xdr; 4095 struct xdr_stream xdr;
4092 struct compound_hdr hdr; 4096 struct compound_hdr hdr;
@@ -4107,7 +4111,7 @@ out:
4107/* 4111/*
4108 * Decode LOCKU response 4112 * Decode LOCKU response
4109 */ 4113 */
4110static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_locku_res *res) 4114static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, __be32 *p, struct nfs_locku_res *res)
4111{ 4115{
4112 struct xdr_stream xdr; 4116 struct xdr_stream xdr;
4113 struct compound_hdr hdr; 4117 struct compound_hdr hdr;
@@ -4128,7 +4132,7 @@ out:
4128/* 4132/*
4129 * Decode READLINK response 4133 * Decode READLINK response
4130 */ 4134 */
4131static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, uint32_t *p, void *res) 4135static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, __be32 *p, void *res)
4132{ 4136{
4133 struct xdr_stream xdr; 4137 struct xdr_stream xdr;
4134 struct compound_hdr hdr; 4138 struct compound_hdr hdr;
@@ -4149,7 +4153,7 @@ out:
4149/* 4153/*
4150 * Decode READDIR response 4154 * Decode READDIR response
4151 */ 4155 */
4152static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_readdir_res *res) 4156static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_readdir_res *res)
4153{ 4157{
4154 struct xdr_stream xdr; 4158 struct xdr_stream xdr;
4155 struct compound_hdr hdr; 4159 struct compound_hdr hdr;
@@ -4170,7 +4174,7 @@ out:
4170/* 4174/*
4171 * Decode Read response 4175 * Decode Read response
4172 */ 4176 */
4173static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_readres *res) 4177static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, __be32 *p, struct nfs_readres *res)
4174{ 4178{
4175 struct xdr_stream xdr; 4179 struct xdr_stream xdr;
4176 struct compound_hdr hdr; 4180 struct compound_hdr hdr;
@@ -4193,7 +4197,7 @@ out:
4193/* 4197/*
4194 * Decode WRITE response 4198 * Decode WRITE response
4195 */ 4199 */
4196static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) 4200static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res)
4197{ 4201{
4198 struct xdr_stream xdr; 4202 struct xdr_stream xdr;
4199 struct compound_hdr hdr; 4203 struct compound_hdr hdr;
@@ -4219,7 +4223,7 @@ out:
4219/* 4223/*
4220 * Decode COMMIT response 4224 * Decode COMMIT response
4221 */ 4225 */
4222static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, uint32_t *p, struct nfs_writeres *res) 4226static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res)
4223{ 4227{
4224 struct xdr_stream xdr; 4228 struct xdr_stream xdr;
4225 struct compound_hdr hdr; 4229 struct compound_hdr hdr;
@@ -4243,7 +4247,7 @@ out:
4243/* 4247/*
4244 * FSINFO request 4248 * FSINFO request
4245 */ 4249 */
4246static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) 4250static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo)
4247{ 4251{
4248 struct xdr_stream xdr; 4252 struct xdr_stream xdr;
4249 struct compound_hdr hdr; 4253 struct compound_hdr hdr;
@@ -4263,7 +4267,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, uint32_t *p, struct nfs_fsi
4263/* 4267/*
4264 * PATHCONF request 4268 * PATHCONF request
4265 */ 4269 */
4266static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_pathconf *pathconf) 4270static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *pathconf)
4267{ 4271{
4268 struct xdr_stream xdr; 4272 struct xdr_stream xdr;
4269 struct compound_hdr hdr; 4273 struct compound_hdr hdr;
@@ -4281,7 +4285,7 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, uint32_t *p, struct nfs_p
4281/* 4285/*
4282 * STATFS request 4286 * STATFS request
4283 */ 4287 */
4284static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fsstat *fsstat) 4288static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *fsstat)
4285{ 4289{
4286 struct xdr_stream xdr; 4290 struct xdr_stream xdr;
4287 struct compound_hdr hdr; 4291 struct compound_hdr hdr;
@@ -4299,7 +4303,7 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, uint32_t *p, struct nfs_fss
4299/* 4303/*
4300 * GETATTR_BITMAP request 4304 * GETATTR_BITMAP request
4301 */ 4305 */
4302static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, uint32_t *p, struct nfs4_server_caps_res *res) 4306static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res)
4303{ 4307{
4304 struct xdr_stream xdr; 4308 struct xdr_stream xdr;
4305 struct compound_hdr hdr; 4309 struct compound_hdr hdr;
@@ -4318,7 +4322,7 @@ out:
4318/* 4322/*
4319 * Decode RENEW response 4323 * Decode RENEW response
4320 */ 4324 */
4321static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) 4325static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy)
4322{ 4326{
4323 struct xdr_stream xdr; 4327 struct xdr_stream xdr;
4324 struct compound_hdr hdr; 4328 struct compound_hdr hdr;
@@ -4334,7 +4338,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy)
4334/* 4338/*
4335 * a SETCLIENTID request 4339 * a SETCLIENTID request
4336 */ 4340 */
4337static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p, 4341static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
4338 struct nfs_client *clp) 4342 struct nfs_client *clp)
4339{ 4343{
4340 struct xdr_stream xdr; 4344 struct xdr_stream xdr;
@@ -4353,7 +4357,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, uint32_t *p,
4353/* 4357/*
4354 * a SETCLIENTID_CONFIRM request 4358 * a SETCLIENTID_CONFIRM request
4355 */ 4359 */
4356static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, struct nfs_fsinfo *fsinfo) 4360static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo)
4357{ 4361{
4358 struct xdr_stream xdr; 4362 struct xdr_stream xdr;
4359 struct compound_hdr hdr; 4363 struct compound_hdr hdr;
@@ -4375,7 +4379,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, uint32_t *p, s
4375/* 4379/*
4376 * DELEGRETURN request 4380 * DELEGRETURN request
4377 */ 4381 */
4378static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, uint32_t *p, struct nfs4_delegreturnres *res) 4382static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res)
4379{ 4383{
4380 struct xdr_stream xdr; 4384 struct xdr_stream xdr;
4381 struct compound_hdr hdr; 4385 struct compound_hdr hdr;
@@ -4397,7 +4401,7 @@ out:
4397/* 4401/*
4398 * FS_LOCATIONS request 4402 * FS_LOCATIONS request
4399 */ 4403 */
4400static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, uint32_t *p, struct nfs4_fs_locations *res) 4404static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations *res)
4401{ 4405{
4402 struct xdr_stream xdr; 4406 struct xdr_stream xdr;
4403 struct compound_hdr hdr; 4407 struct compound_hdr hdr;
@@ -4417,7 +4421,7 @@ out:
4417 return status; 4421 return status;
4418} 4422}
4419 4423
4420uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus) 4424__be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
4421{ 4425{
4422 uint32_t bitmap[2] = {0}; 4426 uint32_t bitmap[2] = {0};
4423 uint32_t len; 4427 uint32_t len;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 28659a919d6e..28108c82b887 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -834,7 +834,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
834 } 834 }
835 /* RFC3530: The default port for NFS is 2049 */ 835 /* RFC3530: The default port for NFS is 2049 */
836 if (addr.sin_port == 0) 836 if (addr.sin_port == 0)
837 addr.sin_port = NFS_PORT; 837 addr.sin_port = htons(NFS_PORT);
838 838
839 /* Grab the authentication type */ 839 /* Grab the authentication type */
840 authflavour = RPC_AUTH_UNIX; 840 authflavour = RPC_AUTH_UNIX;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f6675d2c386c..883dd4a1c157 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -57,6 +57,8 @@
57#include <linux/nfs_fs.h> 57#include <linux/nfs_fs.h>
58#include <linux/nfs_mount.h> 58#include <linux/nfs_mount.h>
59#include <linux/nfs_page.h> 59#include <linux/nfs_page.h>
60#include <linux/backing-dev.h>
61
60#include <asm/uaccess.h> 62#include <asm/uaccess.h>
61#include <linux/smp_lock.h> 63#include <linux/smp_lock.h>
62 64
@@ -395,7 +397,7 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
395out: 397out:
396 clear_bit(BDI_write_congested, &bdi->state); 398 clear_bit(BDI_write_congested, &bdi->state);
397 wake_up_all(&nfs_write_congestion); 399 wake_up_all(&nfs_write_congestion);
398 writeback_congestion_end(); 400 congestion_end(WRITE);
399 return err; 401 return err;
400} 402}
401 403
@@ -588,10 +590,10 @@ static void nfs_cancel_commit_list(struct list_head *head)
588 590
589 while(!list_empty(head)) { 591 while(!list_empty(head)) {
590 req = nfs_list_entry(head->next); 592 req = nfs_list_entry(head->next);
593 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
591 nfs_list_remove_request(req); 594 nfs_list_remove_request(req);
592 nfs_inode_remove_request(req); 595 nfs_inode_remove_request(req);
593 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); 596 nfs_unlock_request(req);
594 nfs_clear_page_writeback(req);
595 } 597 }
596} 598}
597 599
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c
index 0c2be8c0307d..c11f5375d7c1 100644
--- a/fs/nfs_common/nfsacl.c
+++ b/fs/nfs_common/nfsacl.c
@@ -46,7 +46,7 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem)
46{ 46{
47 struct nfsacl_encode_desc *nfsacl_desc = 47 struct nfsacl_encode_desc *nfsacl_desc =
48 (struct nfsacl_encode_desc *) desc; 48 (struct nfsacl_encode_desc *) desc;
49 u32 *p = (u32 *) elem; 49 __be32 *p = elem;
50 50
51 struct posix_acl_entry *entry = 51 struct posix_acl_entry *entry =
52 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++]; 52 &nfsacl_desc->acl->a_entries[nfsacl_desc->count++];
@@ -127,7 +127,7 @@ xdr_nfsace_decode(struct xdr_array2_desc *desc, void *elem)
127{ 127{
128 struct nfsacl_decode_desc *nfsacl_desc = 128 struct nfsacl_decode_desc *nfsacl_desc =
129 (struct nfsacl_decode_desc *) desc; 129 (struct nfsacl_decode_desc *) desc;
130 u32 *p = (u32 *) elem; 130 __be32 *p = elem;
131 struct posix_acl_entry *entry; 131 struct posix_acl_entry *entry;
132 132
133 if (!nfsacl_desc->acl) { 133 if (!nfsacl_desc->acl) {
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index e13fa23bd108..f37df46d2eaa 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1148,12 +1148,12 @@ exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
1148 * for a given NFSv4 client. The root is defined to be the 1148 * for a given NFSv4 client. The root is defined to be the
1149 * export point with fsid==0 1149 * export point with fsid==0
1150 */ 1150 */
1151int 1151__be32
1152exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, 1152exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
1153 struct cache_req *creq) 1153 struct cache_req *creq)
1154{ 1154{
1155 struct svc_export *exp; 1155 struct svc_export *exp;
1156 int rv; 1156 __be32 rv;
1157 u32 fsidv[2]; 1157 u32 fsidv[2];
1158 1158
1159 mk_fsid_v1(fsidv, 0); 1159 mk_fsid_v1(fsidv, 0);
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 9b9e7e127c03..11fdaf7721b4 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -25,7 +25,7 @@
25static u32 25static u32
26nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) 26nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
27{ 27{
28 u32 nfserr; 28 __be32 nfserr;
29 struct svc_fh fh; 29 struct svc_fh fh;
30 30
31 /* must initialize before using! but maxsize doesn't matter */ 31 /* must initialize before using! but maxsize doesn't matter */
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index 9187755661df..e3eca0816986 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -21,7 +21,7 @@
21/* 21/*
22 * NULL call. 22 * NULL call.
23 */ 23 */
24static int 24static __be32
25nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 25nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
26{ 26{
27 return nfs_ok; 27 return nfs_ok;
@@ -30,12 +30,12 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
30/* 30/*
31 * Get the Access and/or Default ACL of a file. 31 * Get the Access and/or Default ACL of a file.
32 */ 32 */
33static int nfsacld_proc_getacl(struct svc_rqst * rqstp, 33static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
34 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 34 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
35{ 35{
36 svc_fh *fh; 36 svc_fh *fh;
37 struct posix_acl *acl; 37 struct posix_acl *acl;
38 int nfserr = 0; 38 __be32 nfserr = 0;
39 39
40 dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); 40 dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
41 41
@@ -97,12 +97,12 @@ fail:
97/* 97/*
98 * Set the Access and/or Default ACL of a file. 98 * Set the Access and/or Default ACL of a file.
99 */ 99 */
100static int nfsacld_proc_setacl(struct svc_rqst * rqstp, 100static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
101 struct nfsd3_setaclargs *argp, 101 struct nfsd3_setaclargs *argp,
102 struct nfsd_attrstat *resp) 102 struct nfsd_attrstat *resp)
103{ 103{
104 svc_fh *fh; 104 svc_fh *fh;
105 int nfserr = 0; 105 __be32 nfserr = 0;
106 106
107 dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); 107 dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
108 108
@@ -128,7 +128,7 @@ static int nfsacld_proc_setacl(struct svc_rqst * rqstp,
128/* 128/*
129 * Check file attributes 129 * Check file attributes
130 */ 130 */
131static int nfsacld_proc_getattr(struct svc_rqst * rqstp, 131static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
132 struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) 132 struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
133{ 133{
134 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 134 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
@@ -140,10 +140,10 @@ static int nfsacld_proc_getattr(struct svc_rqst * rqstp,
140/* 140/*
141 * Check file access 141 * Check file access
142 */ 142 */
143static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 143static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
144 struct nfsd3_accessres *resp) 144 struct nfsd3_accessres *resp)
145{ 145{
146 int nfserr; 146 __be32 nfserr;
147 147
148 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", 148 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n",
149 SVCFH_fmt(&argp->fh), 149 SVCFH_fmt(&argp->fh),
@@ -158,7 +158,7 @@ static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *
158/* 158/*
159 * XDR decode functions 159 * XDR decode functions
160 */ 160 */
161static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, 161static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
162 struct nfsd3_getaclargs *argp) 162 struct nfsd3_getaclargs *argp)
163{ 163{
164 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 164 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -169,7 +169,7 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p,
169} 169}
170 170
171 171
172static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, 172static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
173 struct nfsd3_setaclargs *argp) 173 struct nfsd3_setaclargs *argp)
174{ 174{
175 struct kvec *head = rqstp->rq_arg.head; 175 struct kvec *head = rqstp->rq_arg.head;
@@ -194,7 +194,7 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p,
194 return (n > 0); 194 return (n > 0);
195} 195}
196 196
197static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p, 197static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
198 struct nfsd_fhandle *argp) 198 struct nfsd_fhandle *argp)
199{ 199{
200 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 200 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -202,7 +202,7 @@ static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p,
202 return xdr_argsize_check(rqstp, p); 202 return xdr_argsize_check(rqstp, p);
203} 203}
204 204
205static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, 205static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
206 struct nfsd3_accessargs *argp) 206 struct nfsd3_accessargs *argp)
207{ 207{
208 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 208 if (!(p = nfs2svc_decode_fh(p, &argp->fh)))
@@ -217,7 +217,7 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p,
217 */ 217 */
218 218
219/* GETACL */ 219/* GETACL */
220static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, 220static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
221 struct nfsd3_getaclres *resp) 221 struct nfsd3_getaclres *resp)
222{ 222{
223 struct dentry *dentry = resp->fh.fh_dentry; 223 struct dentry *dentry = resp->fh.fh_dentry;
@@ -259,7 +259,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p,
259 return 1; 259 return 1;
260} 260}
261 261
262static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p, 262static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p,
263 struct nfsd_attrstat *resp) 263 struct nfsd_attrstat *resp)
264{ 264{
265 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); 265 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
@@ -267,7 +267,7 @@ static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p,
267} 267}
268 268
269/* ACCESS */ 269/* ACCESS */
270static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p, 270static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
271 struct nfsd3_accessres *resp) 271 struct nfsd3_accessres *resp)
272{ 272{
273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); 273 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh);
@@ -278,7 +278,7 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p,
278/* 278/*
279 * XDR release functions 279 * XDR release functions
280 */ 280 */
281static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p, 281static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
282 struct nfsd3_getaclres *resp) 282 struct nfsd3_getaclres *resp)
283{ 283{
284 fh_put(&resp->fh); 284 fh_put(&resp->fh);
@@ -287,7 +287,7 @@ static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p,
287 return 1; 287 return 1;
288} 288}
289 289
290static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 290static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
291 struct nfsd_fhandle *resp) 291 struct nfsd_fhandle *resp)
292{ 292{
293 fh_put(&resp->fh); 293 fh_put(&resp->fh);
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index d4bdc00c1169..fcad2895ddb0 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -19,7 +19,7 @@
19/* 19/*
20 * NULL call. 20 * NULL call.
21 */ 21 */
22static int 22static __be32
23nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 23nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
24{ 24{
25 return nfs_ok; 25 return nfs_ok;
@@ -28,12 +28,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
28/* 28/*
29 * Get the Access and/or Default ACL of a file. 29 * Get the Access and/or Default ACL of a file.
30 */ 30 */
31static int nfsd3_proc_getacl(struct svc_rqst * rqstp, 31static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
32 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) 32 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
33{ 33{
34 svc_fh *fh; 34 svc_fh *fh;
35 struct posix_acl *acl; 35 struct posix_acl *acl;
36 int nfserr = 0; 36 __be32 nfserr = 0;
37 37
38 fh = fh_copy(&resp->fh, &argp->fh); 38 fh = fh_copy(&resp->fh, &argp->fh);
39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) 39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
@@ -93,12 +93,12 @@ fail:
93/* 93/*
94 * Set the Access and/or Default ACL of a file. 94 * Set the Access and/or Default ACL of a file.
95 */ 95 */
96static int nfsd3_proc_setacl(struct svc_rqst * rqstp, 96static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp,
97 struct nfsd3_setaclargs *argp, 97 struct nfsd3_setaclargs *argp,
98 struct nfsd3_attrstat *resp) 98 struct nfsd3_attrstat *resp)
99{ 99{
100 svc_fh *fh; 100 svc_fh *fh;
101 int nfserr = 0; 101 __be32 nfserr = 0;
102 102
103 fh = fh_copy(&resp->fh, &argp->fh); 103 fh = fh_copy(&resp->fh, &argp->fh);
104 nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); 104 nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
@@ -122,7 +122,7 @@ static int nfsd3_proc_setacl(struct svc_rqst * rqstp,
122/* 122/*
123 * XDR decode functions 123 * XDR decode functions
124 */ 124 */
125static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, 125static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
126 struct nfsd3_getaclargs *args) 126 struct nfsd3_getaclargs *args)
127{ 127{
128 if (!(p = nfs3svc_decode_fh(p, &args->fh))) 128 if (!(p = nfs3svc_decode_fh(p, &args->fh)))
@@ -133,7 +133,7 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p,
133} 133}
134 134
135 135
136static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, 136static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
137 struct nfsd3_setaclargs *args) 137 struct nfsd3_setaclargs *args)
138{ 138{
139 struct kvec *head = rqstp->rq_arg.head; 139 struct kvec *head = rqstp->rq_arg.head;
@@ -163,7 +163,7 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p,
163 */ 163 */
164 164
165/* GETACL */ 165/* GETACL */
166static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, 166static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
167 struct nfsd3_getaclres *resp) 167 struct nfsd3_getaclres *resp)
168{ 168{
169 struct dentry *dentry = resp->fh.fh_dentry; 169 struct dentry *dentry = resp->fh.fh_dentry;
@@ -208,7 +208,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p,
208} 208}
209 209
210/* SETACL */ 210/* SETACL */
211static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p, 211static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p,
212 struct nfsd3_attrstat *resp) 212 struct nfsd3_attrstat *resp)
213{ 213{
214 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 214 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
@@ -219,7 +219,7 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p,
219/* 219/*
220 * XDR release functions 220 * XDR release functions
221 */ 221 */
222static int nfs3svc_release_getacl(struct svc_rqst *rqstp, u32 *p, 222static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
223 struct nfsd3_getaclres *resp) 223 struct nfsd3_getaclres *resp)
224{ 224{
225 fh_put(&resp->fh); 225 fh_put(&resp->fh);
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index a5ebc7dbb384..64db601c2bd2 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -43,7 +43,7 @@ static int nfs3_ftypes[] = {
43/* 43/*
44 * NULL call. 44 * NULL call.
45 */ 45 */
46static int 46static __be32
47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
48{ 48{
49 return nfs_ok; 49 return nfs_ok;
@@ -52,11 +52,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
52/* 52/*
53 * Get a file's attributes 53 * Get a file's attributes
54 */ 54 */
55static int 55static __be32
56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
57 struct nfsd3_attrstat *resp) 57 struct nfsd3_attrstat *resp)
58{ 58{
59 int err, nfserr; 59 int err;
60 __be32 nfserr;
60 61
61 dprintk("nfsd: GETATTR(3) %s\n", 62 dprintk("nfsd: GETATTR(3) %s\n",
62 SVCFH_fmt(&argp->fh)); 63 SVCFH_fmt(&argp->fh));
@@ -76,11 +77,11 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
76/* 77/*
77 * Set a file's attributes 78 * Set a file's attributes
78 */ 79 */
79static int 80static __be32
80nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp, 81nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
81 struct nfsd3_attrstat *resp) 82 struct nfsd3_attrstat *resp)
82{ 83{
83 int nfserr; 84 __be32 nfserr;
84 85
85 dprintk("nfsd: SETATTR(3) %s\n", 86 dprintk("nfsd: SETATTR(3) %s\n",
86 SVCFH_fmt(&argp->fh)); 87 SVCFH_fmt(&argp->fh));
@@ -94,11 +95,11 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
94/* 95/*
95 * Look up a path name component 96 * Look up a path name component
96 */ 97 */
97static int 98static __be32
98nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 99nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
99 struct nfsd3_diropres *resp) 100 struct nfsd3_diropres *resp)
100{ 101{
101 int nfserr; 102 __be32 nfserr;
102 103
103 dprintk("nfsd: LOOKUP(3) %s %.*s\n", 104 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
104 SVCFH_fmt(&argp->fh), 105 SVCFH_fmt(&argp->fh),
@@ -118,11 +119,11 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
118/* 119/*
119 * Check file access 120 * Check file access
120 */ 121 */
121static int 122static __be32
122nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 123nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
123 struct nfsd3_accessres *resp) 124 struct nfsd3_accessres *resp)
124{ 125{
125 int nfserr; 126 __be32 nfserr;
126 127
127 dprintk("nfsd: ACCESS(3) %s 0x%x\n", 128 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
128 SVCFH_fmt(&argp->fh), 129 SVCFH_fmt(&argp->fh),
@@ -137,11 +138,11 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
137/* 138/*
138 * Read a symlink. 139 * Read a symlink.
139 */ 140 */
140static int 141static __be32
141nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp, 142nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
142 struct nfsd3_readlinkres *resp) 143 struct nfsd3_readlinkres *resp)
143{ 144{
144 int nfserr; 145 __be32 nfserr;
145 146
146 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); 147 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
147 148
@@ -155,11 +156,11 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
155/* 156/*
156 * Read a portion of a file. 157 * Read a portion of a file.
157 */ 158 */
158static int 159static __be32
159nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, 160nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
160 struct nfsd3_readres *resp) 161 struct nfsd3_readres *resp)
161{ 162{
162 int nfserr; 163 __be32 nfserr;
163 u32 max_blocksize = svc_max_payload(rqstp); 164 u32 max_blocksize = svc_max_payload(rqstp);
164 165
165 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n", 166 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n",
@@ -195,11 +196,11 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
195/* 196/*
196 * Write data to a file 197 * Write data to a file
197 */ 198 */
198static int 199static __be32
199nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, 200nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
200 struct nfsd3_writeres *resp) 201 struct nfsd3_writeres *resp)
201{ 202{
202 int nfserr; 203 __be32 nfserr;
203 204
204 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n", 205 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n",
205 SVCFH_fmt(&argp->fh), 206 SVCFH_fmt(&argp->fh),
@@ -223,13 +224,13 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
223 * At least in theory; we'll see how it fares in practice when the 224 * At least in theory; we'll see how it fares in practice when the
224 * first reports about SunOS compatibility problems start to pour in... 225 * first reports about SunOS compatibility problems start to pour in...
225 */ 226 */
226static int 227static __be32
227nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 228nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
228 struct nfsd3_diropres *resp) 229 struct nfsd3_diropres *resp)
229{ 230{
230 svc_fh *dirfhp, *newfhp = NULL; 231 svc_fh *dirfhp, *newfhp = NULL;
231 struct iattr *attr; 232 struct iattr *attr;
232 u32 nfserr; 233 __be32 nfserr;
233 234
234 dprintk("nfsd: CREATE(3) %s %.*s\n", 235 dprintk("nfsd: CREATE(3) %s %.*s\n",
235 SVCFH_fmt(&argp->fh), 236 SVCFH_fmt(&argp->fh),
@@ -265,11 +266,11 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
265/* 266/*
266 * Make directory. This operation is not idempotent. 267 * Make directory. This operation is not idempotent.
267 */ 268 */
268static int 269static __be32
269nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 270nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
270 struct nfsd3_diropres *resp) 271 struct nfsd3_diropres *resp)
271{ 272{
272 int nfserr; 273 __be32 nfserr;
273 274
274 dprintk("nfsd: MKDIR(3) %s %.*s\n", 275 dprintk("nfsd: MKDIR(3) %s %.*s\n",
275 SVCFH_fmt(&argp->fh), 276 SVCFH_fmt(&argp->fh),
@@ -285,11 +286,11 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
285 RETURN_STATUS(nfserr); 286 RETURN_STATUS(nfserr);
286} 287}
287 288
288static int 289static __be32
289nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, 290nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
290 struct nfsd3_diropres *resp) 291 struct nfsd3_diropres *resp)
291{ 292{
292 int nfserr; 293 __be32 nfserr;
293 294
294 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", 295 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
295 SVCFH_fmt(&argp->ffh), 296 SVCFH_fmt(&argp->ffh),
@@ -307,11 +308,12 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
307/* 308/*
308 * Make socket/fifo/device. 309 * Make socket/fifo/device.
309 */ 310 */
310static int 311static __be32
311nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, 312nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
312 struct nfsd3_diropres *resp) 313 struct nfsd3_diropres *resp)
313{ 314{
314 int nfserr, type; 315 __be32 nfserr;
316 int type;
315 dev_t rdev = 0; 317 dev_t rdev = 0;
316 318
317 dprintk("nfsd: MKNOD(3) %s %.*s\n", 319 dprintk("nfsd: MKNOD(3) %s %.*s\n",
@@ -343,11 +345,11 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
343/* 345/*
344 * Remove file/fifo/socket etc. 346 * Remove file/fifo/socket etc.
345 */ 347 */
346static int 348static __be32
347nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 349nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
348 struct nfsd3_attrstat *resp) 350 struct nfsd3_attrstat *resp)
349{ 351{
350 int nfserr; 352 __be32 nfserr;
351 353
352 dprintk("nfsd: REMOVE(3) %s %.*s\n", 354 dprintk("nfsd: REMOVE(3) %s %.*s\n",
353 SVCFH_fmt(&argp->fh), 355 SVCFH_fmt(&argp->fh),
@@ -363,11 +365,11 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
363/* 365/*
364 * Remove a directory 366 * Remove a directory
365 */ 367 */
366static int 368static __be32
367nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 369nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
368 struct nfsd3_attrstat *resp) 370 struct nfsd3_attrstat *resp)
369{ 371{
370 int nfserr; 372 __be32 nfserr;
371 373
372 dprintk("nfsd: RMDIR(3) %s %.*s\n", 374 dprintk("nfsd: RMDIR(3) %s %.*s\n",
373 SVCFH_fmt(&argp->fh), 375 SVCFH_fmt(&argp->fh),
@@ -379,11 +381,11 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
379 RETURN_STATUS(nfserr); 381 RETURN_STATUS(nfserr);
380} 382}
381 383
382static int 384static __be32
383nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, 385nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
384 struct nfsd3_renameres *resp) 386 struct nfsd3_renameres *resp)
385{ 387{
386 int nfserr; 388 __be32 nfserr;
387 389
388 dprintk("nfsd: RENAME(3) %s %.*s ->\n", 390 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
389 SVCFH_fmt(&argp->ffh), 391 SVCFH_fmt(&argp->ffh),
@@ -401,11 +403,11 @@ nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
401 RETURN_STATUS(nfserr); 403 RETURN_STATUS(nfserr);
402} 404}
403 405
404static int 406static __be32
405nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, 407nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
406 struct nfsd3_linkres *resp) 408 struct nfsd3_linkres *resp)
407{ 409{
408 int nfserr; 410 __be32 nfserr;
409 411
410 dprintk("nfsd: LINK(3) %s ->\n", 412 dprintk("nfsd: LINK(3) %s ->\n",
411 SVCFH_fmt(&argp->ffh)); 413 SVCFH_fmt(&argp->ffh));
@@ -424,11 +426,12 @@ nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
424/* 426/*
425 * Read a portion of a directory. 427 * Read a portion of a directory.
426 */ 428 */
427static int 429static __be32
428nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 430nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
429 struct nfsd3_readdirres *resp) 431 struct nfsd3_readdirres *resp)
430{ 432{
431 int nfserr, count; 433 __be32 nfserr;
434 int count;
432 435
433 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", 436 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
434 SVCFH_fmt(&argp->fh), 437 SVCFH_fmt(&argp->fh),
@@ -459,11 +462,12 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
459 * Read a portion of a directory, including file handles and attrs. 462 * Read a portion of a directory, including file handles and attrs.
460 * For now, we choose to ignore the dircount parameter. 463 * For now, we choose to ignore the dircount parameter.
461 */ 464 */
462static int 465static __be32
463nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 466nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
464 struct nfsd3_readdirres *resp) 467 struct nfsd3_readdirres *resp)
465{ 468{
466 int nfserr, count = 0; 469 __be32 nfserr;
470 int count = 0;
467 loff_t offset; 471 loff_t offset;
468 int i; 472 int i;
469 caddr_t page_addr = NULL; 473 caddr_t page_addr = NULL;
@@ -517,11 +521,11 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
517/* 521/*
518 * Get file system stats 522 * Get file system stats
519 */ 523 */
520static int 524static __be32
521nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 525nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
522 struct nfsd3_fsstatres *resp) 526 struct nfsd3_fsstatres *resp)
523{ 527{
524 int nfserr; 528 __be32 nfserr;
525 529
526 dprintk("nfsd: FSSTAT(3) %s\n", 530 dprintk("nfsd: FSSTAT(3) %s\n",
527 SVCFH_fmt(&argp->fh)); 531 SVCFH_fmt(&argp->fh));
@@ -534,11 +538,11 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
534/* 538/*
535 * Get file system info 539 * Get file system info
536 */ 540 */
537static int 541static __be32
538nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 542nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
539 struct nfsd3_fsinfores *resp) 543 struct nfsd3_fsinfores *resp)
540{ 544{
541 int nfserr; 545 __be32 nfserr;
542 u32 max_blocksize = svc_max_payload(rqstp); 546 u32 max_blocksize = svc_max_payload(rqstp);
543 547
544 dprintk("nfsd: FSINFO(3) %s\n", 548 dprintk("nfsd: FSINFO(3) %s\n",
@@ -576,11 +580,11 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
576/* 580/*
577 * Get pathconf info for the specified file 581 * Get pathconf info for the specified file
578 */ 582 */
579static int 583static __be32
580nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 584nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
581 struct nfsd3_pathconfres *resp) 585 struct nfsd3_pathconfres *resp)
582{ 586{
583 int nfserr; 587 __be32 nfserr;
584 588
585 dprintk("nfsd: PATHCONF(3) %s\n", 589 dprintk("nfsd: PATHCONF(3) %s\n",
586 SVCFH_fmt(&argp->fh)); 590 SVCFH_fmt(&argp->fh));
@@ -619,11 +623,11 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
619/* 623/*
620 * Commit a file (range) to stable storage. 624 * Commit a file (range) to stable storage.
621 */ 625 */
622static int 626static __be32
623nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, 627nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
624 struct nfsd3_commitres *resp) 628 struct nfsd3_commitres *resp)
625{ 629{
626 int nfserr; 630 __be32 nfserr;
627 631
628 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", 632 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
629 SVCFH_fmt(&argp->fh), 633 SVCFH_fmt(&argp->fh),
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 247d518248bf..b4baca3053c3 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -42,23 +42,23 @@ static u32 nfs3_ftypes[] = {
42/* 42/*
43 * XDR functions for basic NFS types 43 * XDR functions for basic NFS types
44 */ 44 */
45static inline u32 * 45static inline __be32 *
46encode_time3(u32 *p, struct timespec *time) 46encode_time3(__be32 *p, struct timespec *time)
47{ 47{
48 *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); 48 *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec);
49 return p; 49 return p;
50} 50}
51 51
52static inline u32 * 52static inline __be32 *
53decode_time3(u32 *p, struct timespec *time) 53decode_time3(__be32 *p, struct timespec *time)
54{ 54{
55 time->tv_sec = ntohl(*p++); 55 time->tv_sec = ntohl(*p++);
56 time->tv_nsec = ntohl(*p++); 56 time->tv_nsec = ntohl(*p++);
57 return p; 57 return p;
58} 58}
59 59
60static inline u32 * 60static inline __be32 *
61decode_fh(u32 *p, struct svc_fh *fhp) 61decode_fh(__be32 *p, struct svc_fh *fhp)
62{ 62{
63 unsigned int size; 63 unsigned int size;
64 fh_init(fhp, NFS3_FHSIZE); 64 fh_init(fhp, NFS3_FHSIZE);
@@ -72,13 +72,13 @@ decode_fh(u32 *p, struct svc_fh *fhp)
72} 72}
73 73
74/* Helper function for NFSv3 ACL code */ 74/* Helper function for NFSv3 ACL code */
75u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp) 75__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp)
76{ 76{
77 return decode_fh(p, fhp); 77 return decode_fh(p, fhp);
78} 78}
79 79
80static inline u32 * 80static inline __be32 *
81encode_fh(u32 *p, struct svc_fh *fhp) 81encode_fh(__be32 *p, struct svc_fh *fhp)
82{ 82{
83 unsigned int size = fhp->fh_handle.fh_size; 83 unsigned int size = fhp->fh_handle.fh_size;
84 *p++ = htonl(size); 84 *p++ = htonl(size);
@@ -91,8 +91,8 @@ encode_fh(u32 *p, struct svc_fh *fhp)
91 * Decode a file name and make sure that the path contains 91 * Decode a file name and make sure that the path contains
92 * no slashes or null bytes. 92 * no slashes or null bytes.
93 */ 93 */
94static inline u32 * 94static inline __be32 *
95decode_filename(u32 *p, char **namp, int *lenp) 95decode_filename(__be32 *p, char **namp, int *lenp)
96{ 96{
97 char *name; 97 char *name;
98 int i; 98 int i;
@@ -107,8 +107,8 @@ decode_filename(u32 *p, char **namp, int *lenp)
107 return p; 107 return p;
108} 108}
109 109
110static inline u32 * 110static inline __be32 *
111decode_sattr3(u32 *p, struct iattr *iap) 111decode_sattr3(__be32 *p, struct iattr *iap)
112{ 112{
113 u32 tmp; 113 u32 tmp;
114 114
@@ -153,8 +153,8 @@ decode_sattr3(u32 *p, struct iattr *iap)
153 return p; 153 return p;
154} 154}
155 155
156static inline u32 * 156static inline __be32 *
157encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, 157encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
158 struct kstat *stat) 158 struct kstat *stat)
159{ 159{
160 struct dentry *dentry = fhp->fh_dentry; 160 struct dentry *dentry = fhp->fh_dentry;
@@ -186,8 +186,8 @@ encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp,
186 return p; 186 return p;
187} 187}
188 188
189static inline u32 * 189static inline __be32 *
190encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 190encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
191{ 191{
192 struct inode *inode = fhp->fh_dentry->d_inode; 192 struct inode *inode = fhp->fh_dentry->d_inode;
193 193
@@ -224,8 +224,8 @@ encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
224 * The inode may be NULL if the call failed because of a stale file 224 * The inode may be NULL if the call failed because of a stale file
225 * handle. In this case, no attributes are returned. 225 * handle. In this case, no attributes are returned.
226 */ 226 */
227static u32 * 227static __be32 *
228encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 228encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
229{ 229{
230 struct dentry *dentry = fhp->fh_dentry; 230 struct dentry *dentry = fhp->fh_dentry;
231 if (dentry && dentry->d_inode != NULL) { 231 if (dentry && dentry->d_inode != NULL) {
@@ -243,8 +243,8 @@ encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
243} 243}
244 244
245/* Helper for NFSv3 ACLs */ 245/* Helper for NFSv3 ACLs */
246u32 * 246__be32 *
247nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 247nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
248{ 248{
249 return encode_post_op_attr(rqstp, p, fhp); 249 return encode_post_op_attr(rqstp, p, fhp);
250} 250}
@@ -252,8 +252,8 @@ nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
252/* 252/*
253 * Enocde weak cache consistency data 253 * Enocde weak cache consistency data
254 */ 254 */
255static u32 * 255static __be32 *
256encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 256encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
257{ 257{
258 struct dentry *dentry = fhp->fh_dentry; 258 struct dentry *dentry = fhp->fh_dentry;
259 259
@@ -278,7 +278,7 @@ encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
278 * XDR decode functions 278 * XDR decode functions
279 */ 279 */
280int 280int
281nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) 281nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
282{ 282{
283 if (!(p = decode_fh(p, &args->fh))) 283 if (!(p = decode_fh(p, &args->fh)))
284 return 0; 284 return 0;
@@ -286,7 +286,7 @@ nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args
286} 286}
287 287
288int 288int
289nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, 289nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
290 struct nfsd3_sattrargs *args) 290 struct nfsd3_sattrargs *args)
291{ 291{
292 if (!(p = decode_fh(p, &args->fh)) 292 if (!(p = decode_fh(p, &args->fh))
@@ -303,7 +303,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p,
303} 303}
304 304
305int 305int
306nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, 306nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
307 struct nfsd3_diropargs *args) 307 struct nfsd3_diropargs *args)
308{ 308{
309 if (!(p = decode_fh(p, &args->fh)) 309 if (!(p = decode_fh(p, &args->fh))
@@ -314,7 +314,7 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p,
314} 314}
315 315
316int 316int
317nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, 317nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
318 struct nfsd3_accessargs *args) 318 struct nfsd3_accessargs *args)
319{ 319{
320 if (!(p = decode_fh(p, &args->fh))) 320 if (!(p = decode_fh(p, &args->fh)))
@@ -325,7 +325,7 @@ nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p,
325} 325}
326 326
327int 327int
328nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, 328nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
329 struct nfsd3_readargs *args) 329 struct nfsd3_readargs *args)
330{ 330{
331 unsigned int len; 331 unsigned int len;
@@ -355,7 +355,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
355} 355}
356 356
357int 357int
358nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, 358nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
359 struct nfsd3_writeargs *args) 359 struct nfsd3_writeargs *args)
360{ 360{
361 unsigned int len, v, hdr; 361 unsigned int len, v, hdr;
@@ -393,7 +393,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
393} 393}
394 394
395int 395int
396nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, 396nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
397 struct nfsd3_createargs *args) 397 struct nfsd3_createargs *args)
398{ 398{
399 if (!(p = decode_fh(p, &args->fh)) 399 if (!(p = decode_fh(p, &args->fh))
@@ -417,7 +417,7 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p,
417 return xdr_argsize_check(rqstp, p); 417 return xdr_argsize_check(rqstp, p);
418} 418}
419int 419int
420nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, 420nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p,
421 struct nfsd3_createargs *args) 421 struct nfsd3_createargs *args)
422{ 422{
423 if (!(p = decode_fh(p, &args->fh)) 423 if (!(p = decode_fh(p, &args->fh))
@@ -429,7 +429,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p,
429} 429}
430 430
431int 431int
432nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, 432nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
433 struct nfsd3_symlinkargs *args) 433 struct nfsd3_symlinkargs *args)
434{ 434{
435 unsigned int len; 435 unsigned int len;
@@ -481,7 +481,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
481} 481}
482 482
483int 483int
484nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, 484nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p,
485 struct nfsd3_mknodargs *args) 485 struct nfsd3_mknodargs *args)
486{ 486{
487 if (!(p = decode_fh(p, &args->fh)) 487 if (!(p = decode_fh(p, &args->fh))
@@ -505,7 +505,7 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p,
505} 505}
506 506
507int 507int
508nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, 508nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
509 struct nfsd3_renameargs *args) 509 struct nfsd3_renameargs *args)
510{ 510{
511 if (!(p = decode_fh(p, &args->ffh)) 511 if (!(p = decode_fh(p, &args->ffh))
@@ -518,7 +518,7 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p,
518} 518}
519 519
520int 520int
521nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, 521nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
522 struct nfsd3_readlinkargs *args) 522 struct nfsd3_readlinkargs *args)
523{ 523{
524 if (!(p = decode_fh(p, &args->fh))) 524 if (!(p = decode_fh(p, &args->fh)))
@@ -530,7 +530,7 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p,
530} 530}
531 531
532int 532int
533nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, 533nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
534 struct nfsd3_linkargs *args) 534 struct nfsd3_linkargs *args)
535{ 535{
536 if (!(p = decode_fh(p, &args->ffh)) 536 if (!(p = decode_fh(p, &args->ffh))
@@ -542,7 +542,7 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p,
542} 542}
543 543
544int 544int
545nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, 545nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
546 struct nfsd3_readdirargs *args) 546 struct nfsd3_readdirargs *args)
547{ 547{
548 if (!(p = decode_fh(p, &args->fh))) 548 if (!(p = decode_fh(p, &args->fh)))
@@ -562,7 +562,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
562} 562}
563 563
564int 564int
565nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, 565nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
566 struct nfsd3_readdirargs *args) 566 struct nfsd3_readdirargs *args)
567{ 567{
568 int len, pn; 568 int len, pn;
@@ -590,7 +590,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
590} 590}
591 591
592int 592int
593nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, 593nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p,
594 struct nfsd3_commitargs *args) 594 struct nfsd3_commitargs *args)
595{ 595{
596 if (!(p = decode_fh(p, &args->fh))) 596 if (!(p = decode_fh(p, &args->fh)))
@@ -609,14 +609,14 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p,
609 * will work properly. 609 * will work properly.
610 */ 610 */
611int 611int
612nfs3svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) 612nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
613{ 613{
614 return xdr_ressize_check(rqstp, p); 614 return xdr_ressize_check(rqstp, p);
615} 615}
616 616
617/* GETATTR */ 617/* GETATTR */
618int 618int
619nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, 619nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
620 struct nfsd3_attrstat *resp) 620 struct nfsd3_attrstat *resp)
621{ 621{
622 if (resp->status == 0) 622 if (resp->status == 0)
@@ -626,7 +626,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p,
626 626
627/* SETATTR, REMOVE, RMDIR */ 627/* SETATTR, REMOVE, RMDIR */
628int 628int
629nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, 629nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p,
630 struct nfsd3_attrstat *resp) 630 struct nfsd3_attrstat *resp)
631{ 631{
632 p = encode_wcc_data(rqstp, p, &resp->fh); 632 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -635,7 +635,7 @@ nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p,
635 635
636/* LOOKUP */ 636/* LOOKUP */
637int 637int
638nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, 638nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
639 struct nfsd3_diropres *resp) 639 struct nfsd3_diropres *resp)
640{ 640{
641 if (resp->status == 0) { 641 if (resp->status == 0) {
@@ -648,7 +648,7 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p,
648 648
649/* ACCESS */ 649/* ACCESS */
650int 650int
651nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, 651nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
652 struct nfsd3_accessres *resp) 652 struct nfsd3_accessres *resp)
653{ 653{
654 p = encode_post_op_attr(rqstp, p, &resp->fh); 654 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -659,7 +659,7 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p,
659 659
660/* READLINK */ 660/* READLINK */
661int 661int
662nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, 662nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
663 struct nfsd3_readlinkres *resp) 663 struct nfsd3_readlinkres *resp)
664{ 664{
665 p = encode_post_op_attr(rqstp, p, &resp->fh); 665 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -680,7 +680,7 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
680 680
681/* READ */ 681/* READ */
682int 682int
683nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, 683nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
684 struct nfsd3_readres *resp) 684 struct nfsd3_readres *resp)
685{ 685{
686 p = encode_post_op_attr(rqstp, p, &resp->fh); 686 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -704,7 +704,7 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p,
704 704
705/* WRITE */ 705/* WRITE */
706int 706int
707nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, 707nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p,
708 struct nfsd3_writeres *resp) 708 struct nfsd3_writeres *resp)
709{ 709{
710 p = encode_wcc_data(rqstp, p, &resp->fh); 710 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -719,7 +719,7 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p,
719 719
720/* CREATE, MKDIR, SYMLINK, MKNOD */ 720/* CREATE, MKDIR, SYMLINK, MKNOD */
721int 721int
722nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, 722nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p,
723 struct nfsd3_diropres *resp) 723 struct nfsd3_diropres *resp)
724{ 724{
725 if (resp->status == 0) { 725 if (resp->status == 0) {
@@ -733,7 +733,7 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p,
733 733
734/* RENAME */ 734/* RENAME */
735int 735int
736nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, 736nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p,
737 struct nfsd3_renameres *resp) 737 struct nfsd3_renameres *resp)
738{ 738{
739 p = encode_wcc_data(rqstp, p, &resp->ffh); 739 p = encode_wcc_data(rqstp, p, &resp->ffh);
@@ -743,7 +743,7 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p,
743 743
744/* LINK */ 744/* LINK */
745int 745int
746nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, 746nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p,
747 struct nfsd3_linkres *resp) 747 struct nfsd3_linkres *resp)
748{ 748{
749 p = encode_post_op_attr(rqstp, p, &resp->fh); 749 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -753,7 +753,7 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p,
753 753
754/* READDIR */ 754/* READDIR */
755int 755int
756nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, 756nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
757 struct nfsd3_readdirres *resp) 757 struct nfsd3_readdirres *resp)
758{ 758{
759 p = encode_post_op_attr(rqstp, p, &resp->fh); 759 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -776,8 +776,8 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
776 return xdr_ressize_check(rqstp, p); 776 return xdr_ressize_check(rqstp, p);
777} 777}
778 778
779static inline u32 * 779static inline __be32 *
780encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, 780encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
781 int namlen, ino_t ino) 781 int namlen, ino_t ino)
782{ 782{
783 *p++ = xdr_one; /* mark entry present */ 783 *p++ = xdr_one; /* mark entry present */
@@ -790,8 +790,8 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name,
790 return p; 790 return p;
791} 791}
792 792
793static inline u32 * 793static inline __be32 *
794encode_entryplus_baggage(struct nfsd3_readdirres *cd, u32 *p, 794encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p,
795 struct svc_fh *fhp) 795 struct svc_fh *fhp)
796{ 796{
797 p = encode_post_op_attr(cd->rqstp, p, fhp); 797 p = encode_post_op_attr(cd->rqstp, p, fhp);
@@ -853,7 +853,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
853{ 853{
854 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, 854 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
855 common); 855 common);
856 u32 *p = cd->buffer; 856 __be32 *p = cd->buffer;
857 caddr_t curr_page_addr = NULL; 857 caddr_t curr_page_addr = NULL;
858 int pn; /* current page number */ 858 int pn; /* current page number */
859 int slen; /* string (name) length */ 859 int slen; /* string (name) length */
@@ -919,7 +919,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
919 } else if (cd->rqstp->rq_respages[pn+1] != NULL) { 919 } else if (cd->rqstp->rq_respages[pn+1] != NULL) {
920 /* temporarily encode entry into next page, then move back to 920 /* temporarily encode entry into next page, then move back to
921 * current and next page in rq_respages[] */ 921 * current and next page in rq_respages[] */
922 u32 *p1, *tmp; 922 __be32 *p1, *tmp;
923 int len1, len2; 923 int len1, len2;
924 924
925 /* grab next page for temporary storage of entry */ 925 /* grab next page for temporary storage of entry */
@@ -1009,7 +1009,7 @@ nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name,
1009 1009
1010/* FSSTAT */ 1010/* FSSTAT */
1011int 1011int
1012nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, 1012nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p,
1013 struct nfsd3_fsstatres *resp) 1013 struct nfsd3_fsstatres *resp)
1014{ 1014{
1015 struct kstatfs *s = &resp->stats; 1015 struct kstatfs *s = &resp->stats;
@@ -1031,7 +1031,7 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p,
1031 1031
1032/* FSINFO */ 1032/* FSINFO */
1033int 1033int
1034nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, 1034nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p,
1035 struct nfsd3_fsinfores *resp) 1035 struct nfsd3_fsinfores *resp)
1036{ 1036{
1037 *p++ = xdr_zero; /* no post_op_attr */ 1037 *p++ = xdr_zero; /* no post_op_attr */
@@ -1055,7 +1055,7 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p,
1055 1055
1056/* PATHCONF */ 1056/* PATHCONF */
1057int 1057int
1058nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, 1058nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p,
1059 struct nfsd3_pathconfres *resp) 1059 struct nfsd3_pathconfres *resp)
1060{ 1060{
1061 *p++ = xdr_zero; /* no post_op_attr */ 1061 *p++ = xdr_zero; /* no post_op_attr */
@@ -1074,7 +1074,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p,
1074 1074
1075/* COMMIT */ 1075/* COMMIT */
1076int 1076int
1077nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, 1077nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p,
1078 struct nfsd3_commitres *resp) 1078 struct nfsd3_commitres *resp)
1079{ 1079{
1080 p = encode_wcc_data(rqstp, p, &resp->fh); 1080 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -1090,7 +1090,7 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p,
1090 * XDR release functions 1090 * XDR release functions
1091 */ 1091 */
1092int 1092int
1093nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 1093nfs3svc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
1094 struct nfsd3_attrstat *resp) 1094 struct nfsd3_attrstat *resp)
1095{ 1095{
1096 fh_put(&resp->fh); 1096 fh_put(&resp->fh);
@@ -1098,7 +1098,7 @@ nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p,
1098} 1098}
1099 1099
1100int 1100int
1101nfs3svc_release_fhandle2(struct svc_rqst *rqstp, u32 *p, 1101nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p,
1102 struct nfsd3_fhandle_pair *resp) 1102 struct nfsd3_fhandle_pair *resp)
1103{ 1103{
1104 fh_put(&resp->fh1); 1104 fh_put(&resp->fh1);
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 324a278f2808..f57655a7a2b6 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -85,8 +85,8 @@ enum nfs_cb_opnum4 {
85/* 85/*
86* Generic encode routines from fs/nfs/nfs4xdr.c 86* Generic encode routines from fs/nfs/nfs4xdr.c
87*/ 87*/
88static inline u32 * 88static inline __be32 *
89xdr_writemem(u32 *p, const void *ptr, int nbytes) 89xdr_writemem(__be32 *p, const void *ptr, int nbytes)
90{ 90{
91 int tmp = XDR_QUADLEN(nbytes); 91 int tmp = XDR_QUADLEN(nbytes);
92 if (!tmp) 92 if (!tmp)
@@ -205,7 +205,7 @@ nfs_cb_stat_to_errno(int stat)
205static int 205static int
206encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) 206encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
207{ 207{
208 u32 * p; 208 __be32 * p;
209 209
210 RESERVE_SPACE(16); 210 RESERVE_SPACE(16);
211 WRITE32(0); /* tag length is always 0 */ 211 WRITE32(0); /* tag length is always 0 */
@@ -218,7 +218,7 @@ encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
218static int 218static int
219encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec) 219encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
220{ 220{
221 u32 *p; 221 __be32 *p;
222 int len = cb_rec->cbr_fhlen; 222 int len = cb_rec->cbr_fhlen;
223 223
224 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len); 224 RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len);
@@ -231,7 +231,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
231} 231}
232 232
233static int 233static int
234nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p) 234nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
235{ 235{
236 struct xdr_stream xdrs, *xdr = &xdrs; 236 struct xdr_stream xdrs, *xdr = &xdrs;
237 237
@@ -241,7 +241,7 @@ nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p)
241} 241}
242 242
243static int 243static int
244nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args) 244nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, struct nfs4_cb_recall *args)
245{ 245{
246 struct xdr_stream xdr; 246 struct xdr_stream xdr;
247 struct nfs4_cb_compound_hdr hdr = { 247 struct nfs4_cb_compound_hdr hdr = {
@@ -257,7 +257,7 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args
257 257
258static int 258static int
259decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){ 259decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){
260 u32 *p; 260 __be32 *p;
261 261
262 READ_BUF(8); 262 READ_BUF(8);
263 READ32(hdr->status); 263 READ32(hdr->status);
@@ -272,7 +272,7 @@ decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr)
272static int 272static int
273decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) 273decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
274{ 274{
275 u32 *p; 275 __be32 *p;
276 u32 op; 276 u32 op;
277 int32_t nfserr; 277 int32_t nfserr;
278 278
@@ -291,13 +291,13 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
291} 291}
292 292
293static int 293static int
294nfs4_xdr_dec_cb_null(struct rpc_rqst *req, u32 *p) 294nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
295{ 295{
296 return 0; 296 return 0;
297} 297}
298 298
299static int 299static int
300nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p) 300nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p)
301{ 301{
302 struct xdr_stream xdr; 302 struct xdr_stream xdr;
303 struct nfs4_cb_compound_hdr hdr; 303 struct nfs4_cb_compound_hdr hdr;
@@ -461,7 +461,7 @@ nfs4_cb_null(struct rpc_task *task, void *dummy)
461{ 461{
462 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; 462 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;
463 struct nfs4_callback *cb = &clp->cl_callback; 463 struct nfs4_callback *cb = &clp->cl_callback;
464 u32 addr = htonl(cb->cb_addr); 464 __be32 addr = htonl(cb->cb_addr);
465 465
466 dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status); 466 dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status);
467 467
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index d1fac6872c44..0a7bbdc4a10a 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -67,10 +67,10 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
67 *dst = *src; 67 *dst = *src;
68} 68}
69 69
70static int 70static __be32
71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) 71do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
72{ 72{
73 int status; 73 __be32 status;
74 74
75 if (open->op_truncate && 75 if (open->op_truncate &&
76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) 76 !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
@@ -88,11 +88,11 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
88 return status; 88 return status;
89} 89}
90 90
91static int 91static __be32
92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 92do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
93{ 93{
94 struct svc_fh resfh; 94 struct svc_fh resfh;
95 int status; 95 __be32 status;
96 96
97 fh_init(&resfh, NFS4_FHSIZE); 97 fh_init(&resfh, NFS4_FHSIZE);
98 open->op_truncate = 0; 98 open->op_truncate = 0;
@@ -131,10 +131,10 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
131 return status; 131 return status;
132} 132}
133 133
134static int 134static __be32
135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 135do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
136{ 136{
137 int status; 137 __be32 status;
138 138
139 /* Only reclaims from previously confirmed clients are valid */ 139 /* Only reclaims from previously confirmed clients are valid */
140 if ((status = nfs4_check_open_reclaim(&open->op_clientid))) 140 if ((status = nfs4_check_open_reclaim(&open->op_clientid)))
@@ -161,10 +161,10 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
161} 161}
162 162
163 163
164static inline int 164static inline __be32
165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) 165nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner)
166{ 166{
167 int status; 167 __be32 status;
168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", 168 dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
169 (int)open->op_fname.len, open->op_fname.data, 169 (int)open->op_fname.len, open->op_fname.data,
170 open->op_stateowner); 170 open->op_stateowner);
@@ -177,7 +177,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
177 177
178 /* check seqid for replay. set nfs4_owner */ 178 /* check seqid for replay. set nfs4_owner */
179 status = nfsd4_process_open1(open); 179 status = nfsd4_process_open1(open);
180 if (status == NFSERR_REPLAY_ME) { 180 if (status == nfserr_replay_me) {
181 struct nfs4_replay *rp = &open->op_stateowner->so_replay; 181 struct nfs4_replay *rp = &open->op_stateowner->so_replay;
182 fh_put(current_fh); 182 fh_put(current_fh);
183 current_fh->fh_handle.fh_size = rp->rp_openfh_len; 183 current_fh->fh_handle.fh_size = rp->rp_openfh_len;
@@ -188,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
188 dprintk("nfsd4_open: replay failed" 188 dprintk("nfsd4_open: replay failed"
189 " restoring previous filehandle\n"); 189 " restoring previous filehandle\n");
190 else 190 else
191 status = NFSERR_REPLAY_ME; 191 status = nfserr_replay_me;
192 } 192 }
193 if (status) 193 if (status)
194 goto out; 194 goto out;
@@ -261,7 +261,7 @@ out:
261/* 261/*
262 * filehandle-manipulating ops. 262 * filehandle-manipulating ops.
263 */ 263 */
264static inline int 264static inline __be32
265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) 265nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
266{ 266{
267 if (!current_fh->fh_dentry) 267 if (!current_fh->fh_dentry)
@@ -271,7 +271,7 @@ nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh)
271 return nfs_ok; 271 return nfs_ok;
272} 272}
273 273
274static inline int 274static inline __be32
275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) 275nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh)
276{ 276{
277 fh_put(current_fh); 277 fh_put(current_fh);
@@ -280,10 +280,10 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf
280 return fh_verify(rqstp, current_fh, 0, MAY_NOP); 280 return fh_verify(rqstp, current_fh, 0, MAY_NOP);
281} 281}
282 282
283static inline int 283static inline __be32
284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) 284nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
285{ 285{
286 int status; 286 __be32 status;
287 287
288 fh_put(current_fh); 288 fh_put(current_fh);
289 status = exp_pseudoroot(rqstp->rq_client, current_fh, 289 status = exp_pseudoroot(rqstp->rq_client, current_fh,
@@ -291,7 +291,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
291 return status; 291 return status;
292} 292}
293 293
294static inline int 294static inline __be32
295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 295nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
296{ 296{
297 if (!save_fh->fh_dentry) 297 if (!save_fh->fh_dentry)
@@ -301,7 +301,7 @@ nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
301 return nfs_ok; 301 return nfs_ok;
302} 302}
303 303
304static inline int 304static inline __be32
305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) 305nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
306{ 306{
307 if (!current_fh->fh_dentry) 307 if (!current_fh->fh_dentry)
@@ -314,7 +314,7 @@ nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh)
314/* 314/*
315 * misc nfsv4 ops 315 * misc nfsv4 ops
316 */ 316 */
317static inline int 317static inline __be32
318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) 318nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access)
319{ 319{
320 if (access->ac_req_access & ~NFS3_ACCESS_FULL) 320 if (access->ac_req_access & ~NFS3_ACCESS_FULL)
@@ -324,10 +324,10 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); 324 return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported);
325} 325}
326 326
327static inline int 327static inline __be32
328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) 328nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit)
329{ 329{
330 int status; 330 __be32 status;
331 331
332 u32 *p = (u32 *)commit->co_verf.data; 332 u32 *p = (u32 *)commit->co_verf.data;
333 *p++ = nfssvc_boot.tv_sec; 333 *p++ = nfssvc_boot.tv_sec;
@@ -339,11 +339,11 @@ nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_com
339 return status; 339 return status;
340} 340}
341 341
342static int 342static __be32
343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) 343nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create)
344{ 344{
345 struct svc_fh resfh; 345 struct svc_fh resfh;
346 int status; 346 __be32 status;
347 dev_t rdev; 347 dev_t rdev;
348 348
349 fh_init(&resfh, NFS4_FHSIZE); 349 fh_init(&resfh, NFS4_FHSIZE);
@@ -423,10 +423,10 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre
423 return status; 423 return status;
424} 424}
425 425
426static inline int 426static inline __be32
427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) 427nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr)
428{ 428{
429 int status; 429 __be32 status;
430 430
431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 431 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
432 if (status) 432 if (status)
@@ -442,11 +442,11 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ge
442 return nfs_ok; 442 return nfs_ok;
443} 443}
444 444
445static inline int 445static inline __be32
446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, 446nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
447 struct svc_fh *save_fh, struct nfsd4_link *link) 447 struct svc_fh *save_fh, struct nfsd4_link *link)
448{ 448{
449 int status = nfserr_nofilehandle; 449 __be32 status = nfserr_nofilehandle;
450 450
451 if (!save_fh->fh_dentry) 451 if (!save_fh->fh_dentry)
452 return status; 452 return status;
@@ -456,11 +456,11 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
456 return status; 456 return status;
457} 457}
458 458
459static int 459static __be32
460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) 460nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
461{ 461{
462 struct svc_fh tmp_fh; 462 struct svc_fh tmp_fh;
463 int ret; 463 __be32 ret;
464 464
465 fh_init(&tmp_fh, NFS4_FHSIZE); 465 fh_init(&tmp_fh, NFS4_FHSIZE);
466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, 466 if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh,
@@ -474,16 +474,16 @@ nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); 474 return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh);
475} 475}
476 476
477static inline int 477static inline __be32
478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) 478nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup)
479{ 479{
480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); 480 return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh);
481} 481}
482 482
483static inline int 483static inline __be32
484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) 484nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read)
485{ 485{
486 int status; 486 __be32 status;
487 487
488 /* no need to check permission - this will be done in nfsd_read() */ 488 /* no need to check permission - this will be done in nfsd_read() */
489 489
@@ -508,7 +508,7 @@ out:
508 return status; 508 return status;
509} 509}
510 510
511static inline int 511static inline __be32
512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) 512nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir)
513{ 513{
514 u64 cookie = readdir->rd_cookie; 514 u64 cookie = readdir->rd_cookie;
@@ -531,7 +531,7 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_re
531 return nfs_ok; 531 return nfs_ok;
532} 532}
533 533
534static inline int 534static inline __be32
535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) 535nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink)
536{ 536{
537 readlink->rl_rqstp = rqstp; 537 readlink->rl_rqstp = rqstp;
@@ -539,10 +539,10 @@ nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_r
539 return nfs_ok; 539 return nfs_ok;
540} 540}
541 541
542static inline int 542static inline __be32
543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) 543nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove)
544{ 544{
545 int status; 545 __be32 status;
546 546
547 if (nfs4_in_grace()) 547 if (nfs4_in_grace())
548 return nfserr_grace; 548 return nfserr_grace;
@@ -556,11 +556,11 @@ nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_rem
556 return status; 556 return status;
557} 557}
558 558
559static inline int 559static inline __be32
560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, 560nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
561 struct svc_fh *save_fh, struct nfsd4_rename *rename) 561 struct svc_fh *save_fh, struct nfsd4_rename *rename)
562{ 562{
563 int status = nfserr_nofilehandle; 563 __be32 status = nfserr_nofilehandle;
564 564
565 if (!save_fh->fh_dentry) 565 if (!save_fh->fh_dentry)
566 return status; 566 return status;
@@ -589,10 +589,10 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
589 return status; 589 return status;
590} 590}
591 591
592static inline int 592static inline __be32
593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) 593nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr)
594{ 594{
595 int status = nfs_ok; 595 __be32 status = nfs_ok;
596 596
597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 597 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
598 nfs4_lock_state(); 598 nfs4_lock_state();
@@ -614,13 +614,13 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se
614 return status; 614 return status;
615} 615}
616 616
617static inline int 617static inline __be32
618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) 618nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write)
619{ 619{
620 stateid_t *stateid = &write->wr_stateid; 620 stateid_t *stateid = &write->wr_stateid;
621 struct file *filp = NULL; 621 struct file *filp = NULL;
622 u32 *p; 622 u32 *p;
623 int status = nfs_ok; 623 __be32 status = nfs_ok;
624 624
625 /* no need to check permission - this will be done in nfsd_write() */ 625 /* no need to check permission - this will be done in nfsd_write() */
626 626
@@ -661,12 +661,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME 661 * attributes matched. VERIFY is implemented by mapping NFSERR_SAME
662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. 662 * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK.
663 */ 663 */
664static int 664static __be32
665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) 665nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify)
666{ 666{
667 u32 *buf, *p; 667 __be32 *buf, *p;
668 int count; 668 int count;
669 int status; 669 __be32 status;
670 670
671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP); 671 status = fh_verify(rqstp, current_fh, 0, MAY_NOP);
672 if (status) 672 if (status)
@@ -715,7 +715,7 @@ out_kfree:
715/* 715/*
716 * NULL call. 716 * NULL call.
717 */ 717 */
718static int 718static __be32
719nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 719nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
720{ 720{
721 return nfs_ok; 721 return nfs_ok;
@@ -731,7 +731,7 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
731/* 731/*
732 * COMPOUND call. 732 * COMPOUND call.
733 */ 733 */
734static int 734static __be32
735nfsd4_proc_compound(struct svc_rqst *rqstp, 735nfsd4_proc_compound(struct svc_rqst *rqstp,
736 struct nfsd4_compoundargs *args, 736 struct nfsd4_compoundargs *args,
737 struct nfsd4_compoundres *resp) 737 struct nfsd4_compoundres *resp)
@@ -741,7 +741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
741 struct svc_fh *save_fh = NULL; 741 struct svc_fh *save_fh = NULL;
742 struct nfs4_stateowner *replay_owner = NULL; 742 struct nfs4_stateowner *replay_owner = NULL;
743 int slack_space; /* in words, not bytes! */ 743 int slack_space; /* in words, not bytes! */
744 int status; 744 __be32 status;
745 745
746 status = nfserr_resource; 746 status = nfserr_resource;
747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); 747 current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL);
@@ -937,7 +937,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
937 } 937 }
938 938
939encode_op: 939encode_op:
940 if (op->status == NFSERR_REPLAY_ME) { 940 if (op->status == nfserr_replay_me) {
941 op->replay = &replay_owner->so_replay; 941 op->replay = &replay_owner->so_replay;
942 nfsd4_encode_replay(resp, op); 942 nfsd4_encode_replay(resp, op);
943 status = op->status = op->replay->rp_status; 943 status = op->status = op->replay->rp_status;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1cbd2e4ee122..e9d07704680e 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -83,13 +83,13 @@ md5_to_hex(char *out, char *md5)
83 *out = '\0'; 83 *out = '\0';
84} 84}
85 85
86int 86__be32
87nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) 87nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
88{ 88{
89 struct xdr_netobj cksum; 89 struct xdr_netobj cksum;
90 struct hash_desc desc; 90 struct hash_desc desc;
91 struct scatterlist sg[1]; 91 struct scatterlist sg[1];
92 int status = nfserr_resource; 92 __be32 status = nfserr_resource;
93 93
94 dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", 94 dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
95 clname->len, clname->data); 95 clname->len, clname->data);
@@ -193,7 +193,7 @@ nfsd4_build_dentrylist(void *arg, const char *name, int namlen,
193 struct dentry_list *child; 193 struct dentry_list *child;
194 194
195 if (name && isdotent(name, namlen)) 195 if (name && isdotent(name, namlen))
196 return nfs_ok; 196 return 0;
197 dentry = lookup_one_len(name, parent, namlen); 197 dentry = lookup_one_len(name, parent, namlen);
198 if (IS_ERR(dentry)) 198 if (IS_ERR(dentry))
199 return PTR_ERR(dentry); 199 return PTR_ERR(dentry);
@@ -333,14 +333,14 @@ purge_old(struct dentry *parent, struct dentry *child)
333 int status; 333 int status;
334 334
335 if (nfs4_has_reclaimed_state(child->d_name.name)) 335 if (nfs4_has_reclaimed_state(child->d_name.name))
336 return nfs_ok; 336 return 0;
337 337
338 status = nfsd4_clear_clid_dir(parent, child); 338 status = nfsd4_clear_clid_dir(parent, child);
339 if (status) 339 if (status)
340 printk("failed to remove client recovery directory %s\n", 340 printk("failed to remove client recovery directory %s\n",
341 child->d_name.name); 341 child->d_name.name);
342 /* Keep trying, success or failure: */ 342 /* Keep trying, success or failure: */
343 return nfs_ok; 343 return 0;
344} 344}
345 345
346void 346void
@@ -365,10 +365,10 @@ load_recdir(struct dentry *parent, struct dentry *child)
365 printk("nfsd4: illegal name %s in recovery directory\n", 365 printk("nfsd4: illegal name %s in recovery directory\n",
366 child->d_name.name); 366 child->d_name.name);
367 /* Keep trying; maybe the others are OK: */ 367 /* Keep trying; maybe the others are OK: */
368 return nfs_ok; 368 return 0;
369 } 369 }
370 nfs4_client_to_reclaim(child->d_name.name); 370 nfs4_client_to_reclaim(child->d_name.name);
371 return nfs_ok; 371 return 0;
372} 372}
373 373
374int 374int
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ebcf226a9e4a..293b6495829f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -710,10 +710,10 @@ out_err:
710 * as described above. 710 * as described above.
711 * 711 *
712 */ 712 */
713int 713__be32
714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) 714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
715{ 715{
716 u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 716 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
717 struct xdr_netobj clname = { 717 struct xdr_netobj clname = {
718 .len = setclid->se_namelen, 718 .len = setclid->se_namelen,
719 .data = setclid->se_name, 719 .data = setclid->se_name,
@@ -721,7 +721,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
721 nfs4_verifier clverifier = setclid->se_verf; 721 nfs4_verifier clverifier = setclid->se_verf;
722 unsigned int strhashval; 722 unsigned int strhashval;
723 struct nfs4_client *conf, *unconf, *new; 723 struct nfs4_client *conf, *unconf, *new;
724 int status; 724 __be32 status;
725 char dname[HEXDIR_LEN]; 725 char dname[HEXDIR_LEN];
726 726
727 if (!check_name(clname)) 727 if (!check_name(clname))
@@ -875,14 +875,14 @@ out:
875 * 875 *
876 * NOTE: callback information will be processed here in a future patch 876 * NOTE: callback information will be processed here in a future patch
877 */ 877 */
878int 878__be32
879nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) 879nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm)
880{ 880{
881 u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 881 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
882 struct nfs4_client *conf, *unconf; 882 struct nfs4_client *conf, *unconf;
883 nfs4_verifier confirm = setclientid_confirm->sc_confirm; 883 nfs4_verifier confirm = setclientid_confirm->sc_confirm;
884 clientid_t * clid = &setclientid_confirm->sc_clientid; 884 clientid_t * clid = &setclientid_confirm->sc_clientid;
885 int status; 885 __be32 status;
886 886
887 if (STALE_CLIENTID(clid)) 887 if (STALE_CLIENTID(clid))
888 return nfserr_stale_clientid; 888 return nfserr_stale_clientid;
@@ -1280,13 +1280,13 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) {
1280 * Called to check deny when READ with all zero stateid or 1280 * Called to check deny when READ with all zero stateid or
1281 * WRITE with all zero or all one stateid 1281 * WRITE with all zero or all one stateid
1282 */ 1282 */
1283static int 1283static __be32
1284nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) 1284nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
1285{ 1285{
1286 struct inode *ino = current_fh->fh_dentry->d_inode; 1286 struct inode *ino = current_fh->fh_dentry->d_inode;
1287 struct nfs4_file *fp; 1287 struct nfs4_file *fp;
1288 struct nfs4_stateid *stp; 1288 struct nfs4_stateid *stp;
1289 int ret; 1289 __be32 ret;
1290 1290
1291 dprintk("NFSD: nfs4_share_conflict\n"); 1291 dprintk("NFSD: nfs4_share_conflict\n");
1292 1292
@@ -1444,7 +1444,7 @@ static struct lock_manager_operations nfsd_lease_mng_ops = {
1444}; 1444};
1445 1445
1446 1446
1447int 1447__be32
1448nfsd4_process_open1(struct nfsd4_open *open) 1448nfsd4_process_open1(struct nfsd4_open *open)
1449{ 1449{
1450 clientid_t *clientid = &open->op_clientid; 1450 clientid_t *clientid = &open->op_clientid;
@@ -1477,7 +1477,7 @@ nfsd4_process_open1(struct nfsd4_open *open)
1477 } 1477 }
1478 if (open->op_seqid == sop->so_seqid - 1) { 1478 if (open->op_seqid == sop->so_seqid - 1) {
1479 if (sop->so_replay.rp_buflen) 1479 if (sop->so_replay.rp_buflen)
1480 return NFSERR_REPLAY_ME; 1480 return nfserr_replay_me;
1481 /* The original OPEN failed so spectacularly 1481 /* The original OPEN failed so spectacularly
1482 * that we don't even have replay data saved! 1482 * that we don't even have replay data saved!
1483 * Therefore, we have no choice but to continue 1483 * Therefore, we have no choice but to continue
@@ -1501,7 +1501,7 @@ renew:
1501 return nfs_ok; 1501 return nfs_ok;
1502} 1502}
1503 1503
1504static inline int 1504static inline __be32
1505nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) 1505nfs4_check_delegmode(struct nfs4_delegation *dp, int flags)
1506{ 1506{
1507 if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ)) 1507 if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ))
@@ -1522,12 +1522,12 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid)
1522 return NULL; 1522 return NULL;
1523} 1523}
1524 1524
1525static int 1525static __be32
1526nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, 1526nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
1527 struct nfs4_delegation **dp) 1527 struct nfs4_delegation **dp)
1528{ 1528{
1529 int flags; 1529 int flags;
1530 int status = nfserr_bad_stateid; 1530 __be32 status = nfserr_bad_stateid;
1531 1531
1532 *dp = find_delegation_file(fp, &open->op_delegate_stateid); 1532 *dp = find_delegation_file(fp, &open->op_delegate_stateid);
1533 if (*dp == NULL) 1533 if (*dp == NULL)
@@ -1546,11 +1546,11 @@ out:
1546 return nfs_ok; 1546 return nfs_ok;
1547} 1547}
1548 1548
1549static int 1549static __be32
1550nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) 1550nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp)
1551{ 1551{
1552 struct nfs4_stateid *local; 1552 struct nfs4_stateid *local;
1553 int status = nfserr_share_denied; 1553 __be32 status = nfserr_share_denied;
1554 struct nfs4_stateowner *sop = open->op_stateowner; 1554 struct nfs4_stateowner *sop = open->op_stateowner;
1555 1555
1556 list_for_each_entry(local, &fp->fi_stateids, st_perfile) { 1556 list_for_each_entry(local, &fp->fi_stateids, st_perfile) {
@@ -1575,7 +1575,7 @@ nfs4_alloc_stateid(void)
1575 return kmem_cache_alloc(stateid_slab, GFP_KERNEL); 1575 return kmem_cache_alloc(stateid_slab, GFP_KERNEL);
1576} 1576}
1577 1577
1578static int 1578static __be32
1579nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, 1579nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1580 struct nfs4_delegation *dp, 1580 struct nfs4_delegation *dp,
1581 struct svc_fh *cur_fh, int flags) 1581 struct svc_fh *cur_fh, int flags)
@@ -1590,7 +1590,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1590 get_file(dp->dl_vfs_file); 1590 get_file(dp->dl_vfs_file);
1591 stp->st_vfs_file = dp->dl_vfs_file; 1591 stp->st_vfs_file = dp->dl_vfs_file;
1592 } else { 1592 } else {
1593 int status; 1593 __be32 status;
1594 status = nfsd_open(rqstp, cur_fh, S_IFREG, flags, 1594 status = nfsd_open(rqstp, cur_fh, S_IFREG, flags,
1595 &stp->st_vfs_file); 1595 &stp->st_vfs_file);
1596 if (status) { 1596 if (status) {
@@ -1604,7 +1604,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp,
1604 return 0; 1604 return 0;
1605} 1605}
1606 1606
1607static inline int 1607static inline __be32
1608nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, 1608nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
1609 struct nfsd4_open *open) 1609 struct nfsd4_open *open)
1610{ 1610{
@@ -1619,22 +1619,22 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
1619 return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); 1619 return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0);
1620} 1620}
1621 1621
1622static int 1622static __be32
1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) 1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open)
1624{ 1624{
1625 struct file *filp = stp->st_vfs_file; 1625 struct file *filp = stp->st_vfs_file;
1626 struct inode *inode = filp->f_dentry->d_inode; 1626 struct inode *inode = filp->f_dentry->d_inode;
1627 unsigned int share_access, new_writer; 1627 unsigned int share_access, new_writer;
1628 int status; 1628 __be32 status;
1629 1629
1630 set_access(&share_access, stp->st_access_bmap); 1630 set_access(&share_access, stp->st_access_bmap);
1631 new_writer = (~share_access) & open->op_share_access 1631 new_writer = (~share_access) & open->op_share_access
1632 & NFS4_SHARE_ACCESS_WRITE; 1632 & NFS4_SHARE_ACCESS_WRITE;
1633 1633
1634 if (new_writer) { 1634 if (new_writer) {
1635 status = get_write_access(inode); 1635 int err = get_write_access(inode);
1636 if (status) 1636 if (err)
1637 return nfserrno(status); 1637 return nfserrno(err);
1638 } 1638 }
1639 status = nfsd4_truncate(rqstp, cur_fh, open); 1639 status = nfsd4_truncate(rqstp, cur_fh, open);
1640 if (status) { 1640 if (status) {
@@ -1738,14 +1738,14 @@ out:
1738/* 1738/*
1739 * called with nfs4_lock_state() held. 1739 * called with nfs4_lock_state() held.
1740 */ 1740 */
1741int 1741__be32
1742nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) 1742nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
1743{ 1743{
1744 struct nfs4_file *fp = NULL; 1744 struct nfs4_file *fp = NULL;
1745 struct inode *ino = current_fh->fh_dentry->d_inode; 1745 struct inode *ino = current_fh->fh_dentry->d_inode;
1746 struct nfs4_stateid *stp = NULL; 1746 struct nfs4_stateid *stp = NULL;
1747 struct nfs4_delegation *dp = NULL; 1747 struct nfs4_delegation *dp = NULL;
1748 int status; 1748 __be32 status;
1749 1749
1750 status = nfserr_inval; 1750 status = nfserr_inval;
1751 if (!access_valid(open->op_share_access) 1751 if (!access_valid(open->op_share_access)
@@ -1833,11 +1833,11 @@ static struct work_struct laundromat_work;
1833static void laundromat_main(void *); 1833static void laundromat_main(void *);
1834static DECLARE_WORK(laundromat_work, laundromat_main, NULL); 1834static DECLARE_WORK(laundromat_work, laundromat_main, NULL);
1835 1835
1836int 1836__be32
1837nfsd4_renew(clientid_t *clid) 1837nfsd4_renew(clientid_t *clid)
1838{ 1838{
1839 struct nfs4_client *clp; 1839 struct nfs4_client *clp;
1840 int status; 1840 __be32 status;
1841 1841
1842 nfs4_lock_state(); 1842 nfs4_lock_state();
1843 dprintk("process_renew(%08x/%08x): starting\n", 1843 dprintk("process_renew(%08x/%08x): starting\n",
@@ -1996,9 +1996,9 @@ access_permit_write(unsigned long access_bmap)
1996} 1996}
1997 1997
1998static 1998static
1999int nfs4_check_openmode(struct nfs4_stateid *stp, int flags) 1999__be32 nfs4_check_openmode(struct nfs4_stateid *stp, int flags)
2000{ 2000{
2001 int status = nfserr_openmode; 2001 __be32 status = nfserr_openmode;
2002 2002
2003 if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap))) 2003 if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap)))
2004 goto out; 2004 goto out;
@@ -2009,7 +2009,7 @@ out:
2009 return status; 2009 return status;
2010} 2010}
2011 2011
2012static inline int 2012static inline __be32
2013check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) 2013check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags)
2014{ 2014{
2015 /* Trying to call delegreturn with a special stateid? Yuch: */ 2015 /* Trying to call delegreturn with a special stateid? Yuch: */
@@ -2043,14 +2043,14 @@ io_during_grace_disallowed(struct inode *inode, int flags)
2043/* 2043/*
2044* Checks for stateid operations 2044* Checks for stateid operations
2045*/ 2045*/
2046int 2046__be32
2047nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp) 2047nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp)
2048{ 2048{
2049 struct nfs4_stateid *stp = NULL; 2049 struct nfs4_stateid *stp = NULL;
2050 struct nfs4_delegation *dp = NULL; 2050 struct nfs4_delegation *dp = NULL;
2051 stateid_t *stidp; 2051 stateid_t *stidp;
2052 struct inode *ino = current_fh->fh_dentry->d_inode; 2052 struct inode *ino = current_fh->fh_dentry->d_inode;
2053 int status; 2053 __be32 status;
2054 2054
2055 dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n", 2055 dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n",
2056 stateid->si_boot, stateid->si_stateownerid, 2056 stateid->si_boot, stateid->si_stateownerid,
@@ -2125,7 +2125,7 @@ setlkflg (int type)
2125/* 2125/*
2126 * Checks for sequence id mutating operations. 2126 * Checks for sequence id mutating operations.
2127 */ 2127 */
2128static int 2128static __be32
2129nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock) 2129nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock)
2130{ 2130{
2131 struct nfs4_stateid *stp; 2131 struct nfs4_stateid *stp;
@@ -2169,7 +2169,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2169 clientid_t *lockclid = &lock->v.new.clientid; 2169 clientid_t *lockclid = &lock->v.new.clientid;
2170 struct nfs4_client *clp = sop->so_client; 2170 struct nfs4_client *clp = sop->so_client;
2171 int lkflg = 0; 2171 int lkflg = 0;
2172 int status; 2172 __be32 status;
2173 2173
2174 lkflg = setlkflg(lock->lk_type); 2174 lkflg = setlkflg(lock->lk_type);
2175 2175
@@ -2233,7 +2233,7 @@ check_replay:
2233 if (seqid == sop->so_seqid - 1) { 2233 if (seqid == sop->so_seqid - 1) {
2234 dprintk("NFSD: preprocess_seqid_op: retransmission?\n"); 2234 dprintk("NFSD: preprocess_seqid_op: retransmission?\n");
2235 /* indicate replay to calling function */ 2235 /* indicate replay to calling function */
2236 return NFSERR_REPLAY_ME; 2236 return nfserr_replay_me;
2237 } 2237 }
2238 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", 2238 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n",
2239 sop->so_seqid, seqid); 2239 sop->so_seqid, seqid);
@@ -2241,10 +2241,10 @@ check_replay:
2241 return nfserr_bad_seqid; 2241 return nfserr_bad_seqid;
2242} 2242}
2243 2243
2244int 2244__be32
2245nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner) 2245nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner)
2246{ 2246{
2247 int status; 2247 __be32 status;
2248 struct nfs4_stateowner *sop; 2248 struct nfs4_stateowner *sop;
2249 struct nfs4_stateid *stp; 2249 struct nfs4_stateid *stp;
2250 2250
@@ -2310,10 +2310,10 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap)
2310 } 2310 }
2311} 2311}
2312 2312
2313int 2313__be32
2314nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner) 2314nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner)
2315{ 2315{
2316 int status; 2316 __be32 status;
2317 struct nfs4_stateid *stp; 2317 struct nfs4_stateid *stp;
2318 unsigned int share_access; 2318 unsigned int share_access;
2319 2319
@@ -2365,10 +2365,10 @@ out:
2365/* 2365/*
2366 * nfs4_unlock_state() called after encode 2366 * nfs4_unlock_state() called after encode
2367 */ 2367 */
2368int 2368__be32
2369nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) 2369nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner)
2370{ 2370{
2371 int status; 2371 __be32 status;
2372 struct nfs4_stateid *stp; 2372 struct nfs4_stateid *stp;
2373 2373
2374 dprintk("NFSD: nfsd4_close on file %.*s\n", 2374 dprintk("NFSD: nfsd4_close on file %.*s\n",
@@ -2404,10 +2404,10 @@ out:
2404 return status; 2404 return status;
2405} 2405}
2406 2406
2407int 2407__be32
2408nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr) 2408nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr)
2409{ 2409{
2410 int status; 2410 __be32 status;
2411 2411
2412 if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) 2412 if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0)))
2413 goto out; 2413 goto out;
@@ -2635,7 +2635,7 @@ check_lock_length(u64 offset, u64 length)
2635/* 2635/*
2636 * LOCK operation 2636 * LOCK operation
2637 */ 2637 */
2638int 2638__be32
2639nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) 2639nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner)
2640{ 2640{
2641 struct nfs4_stateowner *open_sop = NULL; 2641 struct nfs4_stateowner *open_sop = NULL;
@@ -2644,8 +2644,9 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2644 struct file *filp; 2644 struct file *filp;
2645 struct file_lock file_lock; 2645 struct file_lock file_lock;
2646 struct file_lock conflock; 2646 struct file_lock conflock;
2647 int status = 0; 2647 __be32 status = 0;
2648 unsigned int strhashval; 2648 unsigned int strhashval;
2649 int err;
2649 2650
2650 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", 2651 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
2651 (long long) lock->lk_offset, 2652 (long long) lock->lk_offset,
@@ -2758,13 +2759,14 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2758 * locks_copy_lock: */ 2759 * locks_copy_lock: */
2759 conflock.fl_ops = NULL; 2760 conflock.fl_ops = NULL;
2760 conflock.fl_lmops = NULL; 2761 conflock.fl_lmops = NULL;
2761 status = posix_lock_file_conf(filp, &file_lock, &conflock); 2762 err = posix_lock_file_conf(filp, &file_lock, &conflock);
2762 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status); 2763 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status);
2763 switch (-status) { 2764 switch (-err) {
2764 case 0: /* success! */ 2765 case 0: /* success! */
2765 update_stateid(&lock_stp->st_stateid); 2766 update_stateid(&lock_stp->st_stateid);
2766 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid, 2767 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid,
2767 sizeof(stateid_t)); 2768 sizeof(stateid_t));
2769 status = 0;
2768 break; 2770 break;
2769 case (EAGAIN): /* conflock holds conflicting lock */ 2771 case (EAGAIN): /* conflock holds conflicting lock */
2770 status = nfserr_denied; 2772 status = nfserr_denied;
@@ -2775,7 +2777,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2775 status = nfserr_deadlock; 2777 status = nfserr_deadlock;
2776 break; 2778 break;
2777 default: 2779 default:
2778 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",status); 2780 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err);
2779 status = nfserr_resource; 2781 status = nfserr_resource;
2780 break; 2782 break;
2781 } 2783 }
@@ -2793,14 +2795,14 @@ out:
2793/* 2795/*
2794 * LOCKT operation 2796 * LOCKT operation
2795 */ 2797 */
2796int 2798__be32
2797nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt) 2799nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt)
2798{ 2800{
2799 struct inode *inode; 2801 struct inode *inode;
2800 struct file file; 2802 struct file file;
2801 struct file_lock file_lock; 2803 struct file_lock file_lock;
2802 struct file_lock conflock; 2804 struct file_lock conflock;
2803 int status; 2805 __be32 status;
2804 2806
2805 if (nfs4_in_grace()) 2807 if (nfs4_in_grace())
2806 return nfserr_grace; 2808 return nfserr_grace;
@@ -2873,13 +2875,14 @@ out:
2873 return status; 2875 return status;
2874} 2876}
2875 2877
2876int 2878__be32
2877nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) 2879nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner)
2878{ 2880{
2879 struct nfs4_stateid *stp; 2881 struct nfs4_stateid *stp;
2880 struct file *filp = NULL; 2882 struct file *filp = NULL;
2881 struct file_lock file_lock; 2883 struct file_lock file_lock;
2882 int status; 2884 __be32 status;
2885 int err;
2883 2886
2884 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", 2887 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n",
2885 (long long) locku->lu_offset, 2888 (long long) locku->lu_offset,
@@ -2917,8 +2920,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2917 /* 2920 /*
2918 * Try to unlock the file in the VFS. 2921 * Try to unlock the file in the VFS.
2919 */ 2922 */
2920 status = posix_lock_file(filp, &file_lock); 2923 err = posix_lock_file(filp, &file_lock);
2921 if (status) { 2924 if (err) {
2922 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); 2925 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n");
2923 goto out_nfserr; 2926 goto out_nfserr;
2924 } 2927 }
@@ -2937,7 +2940,7 @@ out:
2937 return status; 2940 return status;
2938 2941
2939out_nfserr: 2942out_nfserr:
2940 status = nfserrno(status); 2943 status = nfserrno(err);
2941 goto out; 2944 goto out;
2942} 2945}
2943 2946
@@ -2965,7 +2968,7 @@ out:
2965 return status; 2968 return status;
2966} 2969}
2967 2970
2968int 2971__be32
2969nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner) 2972nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner)
2970{ 2973{
2971 clientid_t *clid = &rlockowner->rl_clientid; 2974 clientid_t *clid = &rlockowner->rl_clientid;
@@ -2974,7 +2977,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *
2974 struct xdr_netobj *owner = &rlockowner->rl_owner; 2977 struct xdr_netobj *owner = &rlockowner->rl_owner;
2975 struct list_head matches; 2978 struct list_head matches;
2976 int i; 2979 int i;
2977 int status; 2980 __be32 status;
2978 2981
2979 dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", 2982 dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
2980 clid->cl_boot, clid->cl_id); 2983 clid->cl_boot, clid->cl_id);
@@ -3111,7 +3114,7 @@ nfs4_find_reclaim_client(clientid_t *clid)
3111/* 3114/*
3112* Called from OPEN. Look for clientid in reclaim list. 3115* Called from OPEN. Look for clientid in reclaim list.
3113*/ 3116*/
3114int 3117__be32
3115nfs4_check_open_reclaim(clientid_t *clid) 3118nfs4_check_open_reclaim(clientid_t *clid)
3116{ 3119{
3117 return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; 3120 return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 41fc241b729a..f3f239db04bb 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -68,8 +68,8 @@
68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL 68#define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL
69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL 69#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL
70 70
71static int 71static __be32
72check_filename(char *str, int len, int err) 72check_filename(char *str, int len, __be32 err)
73{ 73{
74 int i; 74 int i;
75 75
@@ -94,8 +94,8 @@ check_filename(char *str, int len, int err)
94 * consistent with the style used in NFSv2/v3... 94 * consistent with the style used in NFSv2/v3...
95 */ 95 */
96#define DECODE_HEAD \ 96#define DECODE_HEAD \
97 u32 *p; \ 97 __be32 *p; \
98 int status 98 __be32 status
99#define DECODE_TAIL \ 99#define DECODE_TAIL \
100 status = 0; \ 100 status = 0; \
101out: \ 101out: \
@@ -144,13 +144,13 @@ xdr_error: \
144 } \ 144 } \
145} while (0) 145} while (0)
146 146
147static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) 147static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
148{ 148{
149 /* We want more bytes than seem to be available. 149 /* We want more bytes than seem to be available.
150 * Maybe we need a new page, maybe we have just run out 150 * Maybe we need a new page, maybe we have just run out
151 */ 151 */
152 int avail = (char*)argp->end - (char*)argp->p; 152 int avail = (char*)argp->end - (char*)argp->p;
153 u32 *p; 153 __be32 *p;
154 if (avail + argp->pagelen < nbytes) 154 if (avail + argp->pagelen < nbytes)
155 return NULL; 155 return NULL;
156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ 156 if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */
@@ -197,7 +197,7 @@ defer_free(struct nfsd4_compoundargs *argp,
197 return 0; 197 return 0;
198} 198}
199 199
200static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) 200static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes)
201{ 201{
202 void *new = NULL; 202 void *new = NULL;
203 if (p == argp->tmp) { 203 if (p == argp->tmp) {
@@ -217,7 +217,7 @@ static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes)
217} 217}
218 218
219 219
220static int 220static __be32
221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) 221nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
222{ 222{
223 u32 bmlen; 223 u32 bmlen;
@@ -240,13 +240,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
240 DECODE_TAIL; 240 DECODE_TAIL;
241} 241}
242 242
243static int 243static __be32
244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, 244nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr,
245 struct nfs4_acl **acl) 245 struct nfs4_acl **acl)
246{ 246{
247 int expected_len, len = 0; 247 int expected_len, len = 0;
248 u32 dummy32; 248 u32 dummy32;
249 char *buf; 249 char *buf;
250 int host_err;
250 251
251 DECODE_HEAD; 252 DECODE_HEAD;
252 iattr->ia_valid = 0; 253 iattr->ia_valid = 0;
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
280 281
281 *acl = nfs4_acl_new(); 282 *acl = nfs4_acl_new();
282 if (*acl == NULL) { 283 if (*acl == NULL) {
283 status = -ENOMEM; 284 host_err = -ENOMEM;
284 goto out_nfserr; 285 goto out_nfserr;
285 } 286 }
286 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); 287 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl);
@@ -295,20 +296,20 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
295 len += XDR_QUADLEN(dummy32) << 2; 296 len += XDR_QUADLEN(dummy32) << 2;
296 READMEM(buf, dummy32); 297 READMEM(buf, dummy32);
297 ace.whotype = nfs4_acl_get_whotype(buf, dummy32); 298 ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
298 status = 0; 299 host_err = 0;
299 if (ace.whotype != NFS4_ACL_WHO_NAMED) 300 if (ace.whotype != NFS4_ACL_WHO_NAMED)
300 ace.who = 0; 301 ace.who = 0;
301 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) 302 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
302 status = nfsd_map_name_to_gid(argp->rqstp, 303 host_err = nfsd_map_name_to_gid(argp->rqstp,
303 buf, dummy32, &ace.who); 304 buf, dummy32, &ace.who);
304 else 305 else
305 status = nfsd_map_name_to_uid(argp->rqstp, 306 host_err = nfsd_map_name_to_uid(argp->rqstp,
306 buf, dummy32, &ace.who); 307 buf, dummy32, &ace.who);
307 if (status) 308 if (host_err)
308 goto out_nfserr; 309 goto out_nfserr;
309 status = nfs4_acl_add_ace(*acl, ace.type, ace.flag, 310 host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
310 ace.access_mask, ace.whotype, ace.who); 311 ace.access_mask, ace.whotype, ace.who);
311 if (status) 312 if (host_err)
312 goto out_nfserr; 313 goto out_nfserr;
313 } 314 }
314 } else 315 } else
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
327 READ_BUF(dummy32); 328 READ_BUF(dummy32);
328 len += (XDR_QUADLEN(dummy32) << 2); 329 len += (XDR_QUADLEN(dummy32) << 2);
329 READMEM(buf, dummy32); 330 READMEM(buf, dummy32);
330 if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) 331 if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
331 goto out_nfserr; 332 goto out_nfserr;
332 iattr->ia_valid |= ATTR_UID; 333 iattr->ia_valid |= ATTR_UID;
333 } 334 }
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
338 READ_BUF(dummy32); 339 READ_BUF(dummy32);
339 len += (XDR_QUADLEN(dummy32) << 2); 340 len += (XDR_QUADLEN(dummy32) << 2);
340 READMEM(buf, dummy32); 341 READMEM(buf, dummy32);
341 if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) 342 if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
342 goto out_nfserr; 343 goto out_nfserr;
343 iattr->ia_valid |= ATTR_GID; 344 iattr->ia_valid |= ATTR_GID;
344 } 345 }
@@ -414,11 +415,11 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
414 DECODE_TAIL; 415 DECODE_TAIL;
415 416
416out_nfserr: 417out_nfserr:
417 status = nfserrno(status); 418 status = nfserrno(host_err);
418 goto out; 419 goto out;
419} 420}
420 421
421static int 422static __be32
422nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) 423nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access)
423{ 424{
424 DECODE_HEAD; 425 DECODE_HEAD;
@@ -429,7 +430,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access
429 DECODE_TAIL; 430 DECODE_TAIL;
430} 431}
431 432
432static int 433static __be32
433nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) 434nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
434{ 435{
435 DECODE_HEAD; 436 DECODE_HEAD;
@@ -444,7 +445,7 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
444} 445}
445 446
446 447
447static int 448static __be32
448nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) 449nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
449{ 450{
450 DECODE_HEAD; 451 DECODE_HEAD;
@@ -456,7 +457,7 @@ nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit
456 DECODE_TAIL; 457 DECODE_TAIL;
457} 458}
458 459
459static int 460static __be32
460nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) 461nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create)
461{ 462{
462 DECODE_HEAD; 463 DECODE_HEAD;
@@ -496,7 +497,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
496 DECODE_TAIL; 497 DECODE_TAIL;
497} 498}
498 499
499static inline int 500static inline __be32
500nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) 501nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
501{ 502{
502 DECODE_HEAD; 503 DECODE_HEAD;
@@ -508,13 +509,13 @@ nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegretu
508 DECODE_TAIL; 509 DECODE_TAIL;
509} 510}
510 511
511static inline int 512static inline __be32
512nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr) 513nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
513{ 514{
514 return nfsd4_decode_bitmap(argp, getattr->ga_bmval); 515 return nfsd4_decode_bitmap(argp, getattr->ga_bmval);
515} 516}
516 517
517static int 518static __be32
518nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) 519nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
519{ 520{
520 DECODE_HEAD; 521 DECODE_HEAD;
@@ -529,7 +530,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
529 DECODE_TAIL; 530 DECODE_TAIL;
530} 531}
531 532
532static int 533static __be32
533nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) 534nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
534{ 535{
535 DECODE_HEAD; 536 DECODE_HEAD;
@@ -568,7 +569,7 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
568 DECODE_TAIL; 569 DECODE_TAIL;
569} 570}
570 571
571static int 572static __be32
572nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) 573nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
573{ 574{
574 DECODE_HEAD; 575 DECODE_HEAD;
@@ -587,7 +588,7 @@ nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
587 DECODE_TAIL; 588 DECODE_TAIL;
588} 589}
589 590
590static int 591static __be32
591nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) 592nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
592{ 593{
593 DECODE_HEAD; 594 DECODE_HEAD;
@@ -606,7 +607,7 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
606 DECODE_TAIL; 607 DECODE_TAIL;
607} 608}
608 609
609static int 610static __be32
610nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup) 611nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup)
611{ 612{
612 DECODE_HEAD; 613 DECODE_HEAD;
@@ -621,7 +622,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup
621 DECODE_TAIL; 622 DECODE_TAIL;
622} 623}
623 624
624static int 625static __be32
625nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) 626nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
626{ 627{
627 DECODE_HEAD; 628 DECODE_HEAD;
@@ -699,7 +700,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
699 DECODE_TAIL; 700 DECODE_TAIL;
700} 701}
701 702
702static int 703static __be32
703nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf) 704nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf)
704{ 705{
705 DECODE_HEAD; 706 DECODE_HEAD;
@@ -713,7 +714,7 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
713 DECODE_TAIL; 714 DECODE_TAIL;
714} 715}
715 716
716static int 717static __be32
717nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down) 718nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down)
718{ 719{
719 DECODE_HEAD; 720 DECODE_HEAD;
@@ -729,7 +730,7 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
729 DECODE_TAIL; 730 DECODE_TAIL;
730} 731}
731 732
732static int 733static __be32
733nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) 734nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
734{ 735{
735 DECODE_HEAD; 736 DECODE_HEAD;
@@ -744,7 +745,7 @@ nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
744 DECODE_TAIL; 745 DECODE_TAIL;
745} 746}
746 747
747static int 748static __be32
748nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) 749nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
749{ 750{
750 DECODE_HEAD; 751 DECODE_HEAD;
@@ -758,7 +759,7 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
758 DECODE_TAIL; 759 DECODE_TAIL;
759} 760}
760 761
761static int 762static __be32
762nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir) 763nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir)
763{ 764{
764 DECODE_HEAD; 765 DECODE_HEAD;
@@ -774,7 +775,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
774 DECODE_TAIL; 775 DECODE_TAIL;
775} 776}
776 777
777static int 778static __be32
778nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) 779nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
779{ 780{
780 DECODE_HEAD; 781 DECODE_HEAD;
@@ -789,7 +790,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove
789 DECODE_TAIL; 790 DECODE_TAIL;
790} 791}
791 792
792static int 793static __be32
793nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename) 794nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename)
794{ 795{
795 DECODE_HEAD; 796 DECODE_HEAD;
@@ -809,7 +810,7 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
809 DECODE_TAIL; 810 DECODE_TAIL;
810} 811}
811 812
812static int 813static __be32
813nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) 814nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
814{ 815{
815 DECODE_HEAD; 816 DECODE_HEAD;
@@ -820,7 +821,7 @@ nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid)
820 DECODE_TAIL; 821 DECODE_TAIL;
821} 822}
822 823
823static int 824static __be32
824nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) 825nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
825{ 826{
826 DECODE_HEAD; 827 DECODE_HEAD;
@@ -834,7 +835,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta
834 DECODE_TAIL; 835 DECODE_TAIL;
835} 836}
836 837
837static int 838static __be32
838nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid) 839nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid)
839{ 840{
840 DECODE_HEAD; 841 DECODE_HEAD;
@@ -859,7 +860,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
859 DECODE_TAIL; 860 DECODE_TAIL;
860} 861}
861 862
862static int 863static __be32
863nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c) 864nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c)
864{ 865{
865 DECODE_HEAD; 866 DECODE_HEAD;
@@ -872,7 +873,7 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s
872} 873}
873 874
874/* Also used for NVERIFY */ 875/* Also used for NVERIFY */
875static int 876static __be32
876nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) 877nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
877{ 878{
878#if 0 879#if 0
@@ -908,7 +909,7 @@ nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify
908 DECODE_TAIL; 909 DECODE_TAIL;
909} 910}
910 911
911static int 912static __be32
912nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) 913nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
913{ 914{
914 int avail; 915 int avail;
@@ -951,15 +952,15 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
951 argp->pagelen -= len; 952 argp->pagelen -= len;
952 } 953 }
953 } 954 }
954 argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); 955 argp->end = (__be32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len);
955 argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); 956 argp->p = (__be32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2));
956 argp->rqstp->rq_vec[v].iov_len = len; 957 argp->rqstp->rq_vec[v].iov_len = len;
957 write->wr_vlen = v+1; 958 write->wr_vlen = v+1;
958 959
959 DECODE_TAIL; 960 DECODE_TAIL;
960} 961}
961 962
962static int 963static __be32
963nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner) 964nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
964{ 965{
965 DECODE_HEAD; 966 DECODE_HEAD;
@@ -973,7 +974,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
973 DECODE_TAIL; 974 DECODE_TAIL;
974} 975}
975 976
976static int 977static __be32
977nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 978nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
978{ 979{
979 DECODE_HEAD; 980 DECODE_HEAD;
@@ -1179,7 +1180,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1179 * task to translate them into Linux-specific versions which are more 1180 * task to translate them into Linux-specific versions which are more
1180 * consistent with the style used in NFSv2/v3... 1181 * consistent with the style used in NFSv2/v3...
1181 */ 1182 */
1182#define ENCODE_HEAD u32 *p 1183#define ENCODE_HEAD __be32 *p
1183 1184
1184#define WRITE32(n) *p++ = htonl(n) 1185#define WRITE32(n) *p++ = htonl(n)
1185#define WRITE64(n) do { \ 1186#define WRITE64(n) do { \
@@ -1209,8 +1210,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1209 * Header routine to setup seqid operation replay cache 1210 * Header routine to setup seqid operation replay cache
1210 */ 1211 */
1211#define ENCODE_SEQID_OP_HEAD \ 1212#define ENCODE_SEQID_OP_HEAD \
1212 u32 *p; \ 1213 __be32 *p; \
1213 u32 *save; \ 1214 __be32 *save; \
1214 \ 1215 \
1215 save = resp->p; 1216 save = resp->p;
1216 1217
@@ -1234,11 +1235,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1234/* Encode as an array of strings the string given with components 1235/* Encode as an array of strings the string given with components
1235 * seperated @sep. 1236 * seperated @sep.
1236 */ 1237 */
1237static int nfsd4_encode_components(char sep, char *components, 1238static __be32 nfsd4_encode_components(char sep, char *components,
1238 u32 **pp, int *buflen) 1239 __be32 **pp, int *buflen)
1239{ 1240{
1240 u32 *p = *pp; 1241 __be32 *p = *pp;
1241 u32 *countp = p; 1242 __be32 *countp = p;
1242 int strlen, count=0; 1243 int strlen, count=0;
1243 char *str, *end; 1244 char *str, *end;
1244 1245
@@ -1271,11 +1272,11 @@ static int nfsd4_encode_components(char sep, char *components,
1271/* 1272/*
1272 * encode a location element of a fs_locations structure 1273 * encode a location element of a fs_locations structure
1273 */ 1274 */
1274static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, 1275static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1275 u32 **pp, int *buflen) 1276 __be32 **pp, int *buflen)
1276{ 1277{
1277 int status; 1278 __be32 status;
1278 u32 *p = *pp; 1279 __be32 *p = *pp;
1279 1280
1280 status = nfsd4_encode_components(':', location->hosts, &p, buflen); 1281 status = nfsd4_encode_components(':', location->hosts, &p, buflen);
1281 if (status) 1282 if (status)
@@ -1292,16 +1293,15 @@ static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location,
1292 * Returned string is safe to use as long as the caller holds a reference 1293 * Returned string is safe to use as long as the caller holds a reference
1293 * to @exp. 1294 * to @exp.
1294 */ 1295 */
1295static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) 1296static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat)
1296{ 1297{
1297 struct svc_fh tmp_fh; 1298 struct svc_fh tmp_fh;
1298 char *path, *rootpath; 1299 char *path, *rootpath;
1299 int stat;
1300 1300
1301 fh_init(&tmp_fh, NFS4_FHSIZE); 1301 fh_init(&tmp_fh, NFS4_FHSIZE);
1302 stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle); 1302 *stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle);
1303 if (stat) 1303 if (*stat)
1304 return ERR_PTR(stat); 1304 return NULL;
1305 rootpath = tmp_fh.fh_export->ex_path; 1305 rootpath = tmp_fh.fh_export->ex_path;
1306 1306
1307 path = exp->ex_path; 1307 path = exp->ex_path;
@@ -1309,7 +1309,8 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1309 if (strncmp(path, rootpath, strlen(rootpath))) { 1309 if (strncmp(path, rootpath, strlen(rootpath))) {
1310 printk("nfsd: fs_locations failed;" 1310 printk("nfsd: fs_locations failed;"
1311 "%s is not contained in %s\n", path, rootpath); 1311 "%s is not contained in %s\n", path, rootpath);
1312 return ERR_PTR(-EOPNOTSUPP); 1312 *stat = nfserr_notsupp;
1313 return NULL;
1313 } 1314 }
1314 1315
1315 return path + strlen(rootpath); 1316 return path + strlen(rootpath);
@@ -1318,17 +1319,18 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp)
1318/* 1319/*
1319 * encode a fs_locations structure 1320 * encode a fs_locations structure
1320 */ 1321 */
1321static int nfsd4_encode_fs_locations(struct svc_rqst *rqstp, 1322static __be32 nfsd4_encode_fs_locations(struct svc_rqst *rqstp,
1322 struct svc_export *exp, 1323 struct svc_export *exp,
1323 u32 **pp, int *buflen) 1324 __be32 **pp, int *buflen)
1324{ 1325{
1325 int status, i; 1326 __be32 status;
1326 u32 *p = *pp; 1327 int i;
1328 __be32 *p = *pp;
1327 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; 1329 struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs;
1328 char *root = nfsd4_path(rqstp, exp); 1330 char *root = nfsd4_path(rqstp, exp, &status);
1329 1331
1330 if (IS_ERR(root)) 1332 if (status)
1331 return PTR_ERR(root); 1333 return status;
1332 status = nfsd4_encode_components('/', root, &p, buflen); 1334 status = nfsd4_encode_components('/', root, &p, buflen);
1333 if (status) 1335 if (status)
1334 return status; 1336 return status;
@@ -1352,9 +1354,9 @@ static u32 nfs4_ftypes[16] = {
1352 NF4SOCK, NF4BAD, NF4LNK, NF4BAD, 1354 NF4SOCK, NF4BAD, NF4LNK, NF4BAD,
1353}; 1355};
1354 1356
1355static int 1357static __be32
1356nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1358nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1357 u32 **p, int *buflen) 1359 __be32 **p, int *buflen)
1358{ 1360{
1359 int status; 1361 int status;
1360 1362
@@ -1374,21 +1376,21 @@ nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1374 return 0; 1376 return 0;
1375} 1377}
1376 1378
1377static inline int 1379static inline __be32
1378nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) 1380nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, __be32 **p, int *buflen)
1379{ 1381{
1380 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); 1382 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen);
1381} 1383}
1382 1384
1383static inline int 1385static inline __be32
1384nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) 1386nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, __be32 **p, int *buflen)
1385{ 1387{
1386 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); 1388 return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen);
1387} 1389}
1388 1390
1389static inline int 1391static inline __be32
1390nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, 1392nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1391 u32 **p, int *buflen) 1393 __be32 **p, int *buflen)
1392{ 1394{
1393 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); 1395 return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen);
1394} 1396}
@@ -1397,7 +1399,7 @@ nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group,
1397 FATTR4_WORD0_RDATTR_ERROR) 1399 FATTR4_WORD0_RDATTR_ERROR)
1398#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID 1400#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
1399 1401
1400static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) 1402static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1401{ 1403{
1402 /* As per referral draft: */ 1404 /* As per referral draft: */
1403 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || 1405 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||
@@ -1420,9 +1422,9 @@ static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
1420 * @countp is the buffer size in _words_; upon successful return this becomes 1422 * @countp is the buffer size in _words_; upon successful return this becomes
1421 * replaced with the number of words written. 1423 * replaced with the number of words written.
1422 */ 1424 */
1423int 1425__be32
1424nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 1426nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1425 struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval, 1427 struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval,
1426 struct svc_rqst *rqstp) 1428 struct svc_rqst *rqstp)
1427{ 1429{
1428 u32 bmval0 = bmval[0]; 1430 u32 bmval0 = bmval[0];
@@ -1431,12 +1433,13 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1431 struct svc_fh tempfh; 1433 struct svc_fh tempfh;
1432 struct kstatfs statfs; 1434 struct kstatfs statfs;
1433 int buflen = *countp << 2; 1435 int buflen = *countp << 2;
1434 u32 *attrlenp; 1436 __be32 *attrlenp;
1435 u32 dummy; 1437 u32 dummy;
1436 u64 dummy64; 1438 u64 dummy64;
1437 u32 rdattr_err = 0; 1439 u32 rdattr_err = 0;
1438 u32 *p = buffer; 1440 __be32 *p = buffer;
1439 int status; 1441 __be32 status;
1442 int err;
1440 int aclsupport = 0; 1443 int aclsupport = 0;
1441 struct nfs4_acl *acl = NULL; 1444 struct nfs4_acl *acl = NULL;
1442 1445
@@ -1450,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1450 goto out; 1453 goto out;
1451 } 1454 }
1452 1455
1453 status = vfs_getattr(exp->ex_mnt, dentry, &stat); 1456 err = vfs_getattr(exp->ex_mnt, dentry, &stat);
1454 if (status) 1457 if (err)
1455 goto out_nfserr; 1458 goto out_nfserr;
1456 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || 1459 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
1457 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | 1460 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1458 FATTR4_WORD1_SPACE_TOTAL))) { 1461 FATTR4_WORD1_SPACE_TOTAL))) {
1459 status = vfs_statfs(dentry, &statfs); 1462 err = vfs_statfs(dentry, &statfs);
1460 if (status) 1463 if (err)
1461 goto out_nfserr; 1464 goto out_nfserr;
1462 } 1465 }
1463 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { 1466 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
@@ -1469,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1469 } 1472 }
1470 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT 1473 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
1471 | FATTR4_WORD0_SUPPORTED_ATTRS)) { 1474 | FATTR4_WORD0_SUPPORTED_ATTRS)) {
1472 status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); 1475 err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
1473 aclsupport = (status == 0); 1476 aclsupport = (err == 0);
1474 if (bmval0 & FATTR4_WORD0_ACL) { 1477 if (bmval0 & FATTR4_WORD0_ACL) {
1475 if (status == -EOPNOTSUPP) 1478 if (err == -EOPNOTSUPP)
1476 bmval0 &= ~FATTR4_WORD0_ACL; 1479 bmval0 &= ~FATTR4_WORD0_ACL;
1477 else if (status == -EINVAL) { 1480 else if (err == -EINVAL) {
1478 status = nfserr_attrnotsupp; 1481 status = nfserr_attrnotsupp;
1479 goto out; 1482 goto out;
1480 } else if (status != 0) 1483 } else if (err != 0)
1481 goto out_nfserr; 1484 goto out_nfserr;
1482 } 1485 }
1483 } 1486 }
@@ -1817,7 +1820,7 @@ out:
1817 fh_put(&tempfh); 1820 fh_put(&tempfh);
1818 return status; 1821 return status;
1819out_nfserr: 1822out_nfserr:
1820 status = nfserrno(status); 1823 status = nfserrno(err);
1821 goto out; 1824 goto out;
1822out_resource: 1825out_resource:
1823 *countp = 0; 1826 *countp = 0;
@@ -1828,13 +1831,13 @@ out_serverfault:
1828 goto out; 1831 goto out;
1829} 1832}
1830 1833
1831static int 1834static __be32
1832nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, 1835nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
1833 const char *name, int namlen, u32 *p, int *buflen) 1836 const char *name, int namlen, __be32 *p, int *buflen)
1834{ 1837{
1835 struct svc_export *exp = cd->rd_fhp->fh_export; 1838 struct svc_export *exp = cd->rd_fhp->fh_export;
1836 struct dentry *dentry; 1839 struct dentry *dentry;
1837 int nfserr; 1840 __be32 nfserr;
1838 1841
1839 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); 1842 dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
1840 if (IS_ERR(dentry)) 1843 if (IS_ERR(dentry))
@@ -1863,10 +1866,10 @@ out_put:
1863 return nfserr; 1866 return nfserr;
1864} 1867}
1865 1868
1866static u32 * 1869static __be32 *
1867nfsd4_encode_rdattr_error(u32 *p, int buflen, int nfserr) 1870nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
1868{ 1871{
1869 u32 *attrlenp; 1872 __be32 *attrlenp;
1870 1873
1871 if (buflen < 6) 1874 if (buflen < 6)
1872 return NULL; 1875 return NULL;
@@ -1886,8 +1889,8 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
1886{ 1889{
1887 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); 1890 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
1888 int buflen; 1891 int buflen;
1889 u32 *p = cd->buffer; 1892 __be32 *p = cd->buffer;
1890 int nfserr = nfserr_toosmall; 1893 __be32 nfserr = nfserr_toosmall;
1891 1894
1892 /* In nfsv4, "." and ".." never make it onto the wire.. */ 1895 /* In nfsv4, "." and ".." never make it onto the wire.. */
1893 if (name && isdotent(name, namlen)) { 1896 if (name && isdotent(name, namlen)) {
@@ -1943,7 +1946,7 @@ fail:
1943} 1946}
1944 1947
1945static void 1948static void
1946nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_access *access) 1949nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
1947{ 1950{
1948 ENCODE_HEAD; 1951 ENCODE_HEAD;
1949 1952
@@ -1956,7 +1959,7 @@ nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_acc
1956} 1959}
1957 1960
1958static void 1961static void
1959nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_close *close) 1962nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_close *close)
1960{ 1963{
1961 ENCODE_SEQID_OP_HEAD; 1964 ENCODE_SEQID_OP_HEAD;
1962 1965
@@ -1971,7 +1974,7 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos
1971 1974
1972 1975
1973static void 1976static void
1974nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_commit *commit) 1977nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit)
1975{ 1978{
1976 ENCODE_HEAD; 1979 ENCODE_HEAD;
1977 1980
@@ -1983,7 +1986,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com
1983} 1986}
1984 1987
1985static void 1988static void
1986nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_create *create) 1989nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create)
1987{ 1990{
1988 ENCODE_HEAD; 1991 ENCODE_HEAD;
1989 1992
@@ -1997,8 +2000,8 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_cre
1997 } 2000 }
1998} 2001}
1999 2002
2000static int 2003static __be32
2001nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_getattr *getattr) 2004nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_getattr *getattr)
2002{ 2005{
2003 struct svc_fh *fhp = getattr->ga_fhp; 2006 struct svc_fh *fhp = getattr->ga_fhp;
2004 int buflen; 2007 int buflen;
@@ -2016,7 +2019,7 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ge
2016} 2019}
2017 2020
2018static void 2021static void
2019nfsd4_encode_getfh(struct nfsd4_compoundres *resp, int nfserr, struct svc_fh *fhp) 2022nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh *fhp)
2020{ 2023{
2021 unsigned int len; 2024 unsigned int len;
2022 ENCODE_HEAD; 2025 ENCODE_HEAD;
@@ -2056,7 +2059,7 @@ nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denie
2056} 2059}
2057 2060
2058static void 2061static void
2059nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock *lock) 2062nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lock *lock)
2060{ 2063{
2061 ENCODE_SEQID_OP_HEAD; 2064 ENCODE_SEQID_OP_HEAD;
2062 2065
@@ -2072,14 +2075,14 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2072} 2075}
2073 2076
2074static void 2077static void
2075nfsd4_encode_lockt(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lockt *lockt) 2078nfsd4_encode_lockt(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lockt *lockt)
2076{ 2079{
2077 if (nfserr == nfserr_denied) 2080 if (nfserr == nfserr_denied)
2078 nfsd4_encode_lock_denied(resp, &lockt->lt_denied); 2081 nfsd4_encode_lock_denied(resp, &lockt->lt_denied);
2079} 2082}
2080 2083
2081static void 2084static void
2082nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_locku *locku) 2085nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_locku *locku)
2083{ 2086{
2084 ENCODE_SEQID_OP_HEAD; 2087 ENCODE_SEQID_OP_HEAD;
2085 2088
@@ -2095,7 +2098,7 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock
2095 2098
2096 2099
2097static void 2100static void
2098nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link) 2101nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link)
2099{ 2102{
2100 ENCODE_HEAD; 2103 ENCODE_HEAD;
2101 2104
@@ -2108,7 +2111,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link
2108 2111
2109 2112
2110static void 2113static void
2111nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open *open) 2114nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
2112{ 2115{
2113 ENCODE_SEQID_OP_HEAD; 2116 ENCODE_SEQID_OP_HEAD;
2114 2117
@@ -2173,7 +2176,7 @@ out:
2173} 2176}
2174 2177
2175static void 2178static void
2176nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_confirm *oc) 2179nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc)
2177{ 2180{
2178 ENCODE_SEQID_OP_HEAD; 2181 ENCODE_SEQID_OP_HEAD;
2179 2182
@@ -2188,7 +2191,7 @@ nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfs
2188} 2191}
2189 2192
2190static void 2193static void
2191nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_downgrade *od) 2194nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
2192{ 2195{
2193 ENCODE_SEQID_OP_HEAD; 2196 ENCODE_SEQID_OP_HEAD;
2194 2197
@@ -2202,8 +2205,8 @@ nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct n
2202 ENCODE_SEQID_OP_TAIL(od->od_stateowner); 2205 ENCODE_SEQID_OP_TAIL(od->od_stateowner);
2203} 2206}
2204 2207
2205static int 2208static __be32
2206nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, 2209nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2207 struct nfsd4_read *read) 2210 struct nfsd4_read *read)
2208{ 2211{
2209 u32 eof; 2212 u32 eof;
@@ -2267,8 +2270,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr,
2267 return 0; 2270 return 0;
2268} 2271}
2269 2272
2270static int 2273static __be32
2271nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readlink *readlink) 2274nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readlink *readlink)
2272{ 2275{
2273 int maxcount; 2276 int maxcount;
2274 char *page; 2277 char *page;
@@ -2315,12 +2318,12 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2315 return 0; 2318 return 0;
2316} 2319}
2317 2320
2318static int 2321static __be32
2319nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readdir *readdir) 2322nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readdir *readdir)
2320{ 2323{
2321 int maxcount; 2324 int maxcount;
2322 loff_t offset; 2325 loff_t offset;
2323 u32 *page, *savep, *tailbase; 2326 __be32 *page, *savep, *tailbase;
2324 ENCODE_HEAD; 2327 ENCODE_HEAD;
2325 2328
2326 if (nfserr) 2329 if (nfserr)
@@ -2395,7 +2398,7 @@ err_no_verf:
2395} 2398}
2396 2399
2397static void 2400static void
2398nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_remove *remove) 2401nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove)
2399{ 2402{
2400 ENCODE_HEAD; 2403 ENCODE_HEAD;
2401 2404
@@ -2407,7 +2410,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rem
2407} 2410}
2408 2411
2409static void 2412static void
2410nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rename *rename) 2413nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename)
2411{ 2414{
2412 ENCODE_HEAD; 2415 ENCODE_HEAD;
2413 2416
@@ -2424,7 +2427,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ren
2424 * regardless of the error status. 2427 * regardless of the error status.
2425 */ 2428 */
2426static void 2429static void
2427nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setattr *setattr) 2430nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr)
2428{ 2431{
2429 ENCODE_HEAD; 2432 ENCODE_HEAD;
2430 2433
@@ -2443,7 +2446,7 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_se
2443} 2446}
2444 2447
2445static void 2448static void
2446nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setclientid *scd) 2449nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd)
2447{ 2450{
2448 ENCODE_HEAD; 2451 ENCODE_HEAD;
2449 2452
@@ -2462,7 +2465,7 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd
2462} 2465}
2463 2466
2464static void 2467static void
2465nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_write *write) 2468nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write)
2466{ 2469{
2467 ENCODE_HEAD; 2470 ENCODE_HEAD;
2468 2471
@@ -2478,7 +2481,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
2478void 2481void
2479nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) 2482nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2480{ 2483{
2481 u32 *statp; 2484 __be32 *statp;
2482 ENCODE_HEAD; 2485 ENCODE_HEAD;
2483 2486
2484 RESERVE_SPACE(8); 2487 RESERVE_SPACE(8);
@@ -2616,7 +2619,7 @@ nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
2616 */ 2619 */
2617 2620
2618int 2621int
2619nfs4svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) 2622nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
2620{ 2623{
2621 return xdr_ressize_check(rqstp, p); 2624 return xdr_ressize_check(rqstp, p);
2622} 2625}
@@ -2638,9 +2641,9 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
2638} 2641}
2639 2642
2640int 2643int
2641nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundargs *args) 2644nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args)
2642{ 2645{
2643 int status; 2646 __be32 status;
2644 2647
2645 args->p = p; 2648 args->p = p;
2646 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len; 2649 args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len;
@@ -2659,7 +2662,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoun
2659} 2662}
2660 2663
2661int 2664int
2662nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundres *resp) 2665nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp)
2663{ 2666{
2664 /* 2667 /*
2665 * All that remains is to write the tag and operation count... 2668 * All that remains is to write the tag and operation count...
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index fdf7cf3dfadc..6100bbe27432 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -29,7 +29,7 @@
29 */ 29 */
30#define CACHESIZE 1024 30#define CACHESIZE 1024
31#define HASHSIZE 64 31#define HASHSIZE 64
32#define REQHASH(xid) ((((xid) >> 24) ^ (xid)) & (HASHSIZE-1)) 32#define REQHASH(xid) (((((__force __u32)xid) >> 24) ^ ((__force __u32)xid)) & (HASHSIZE-1))
33 33
34static struct hlist_head * hash_list; 34static struct hlist_head * hash_list;
35static struct list_head lru_head; 35static struct list_head lru_head;
@@ -127,8 +127,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type)
127 struct hlist_node *hn; 127 struct hlist_node *hn;
128 struct hlist_head *rh; 128 struct hlist_head *rh;
129 struct svc_cacherep *rp; 129 struct svc_cacherep *rp;
130 u32 xid = rqstp->rq_xid, 130 __be32 xid = rqstp->rq_xid;
131 proto = rqstp->rq_prot, 131 u32 proto = rqstp->rq_prot,
132 vers = rqstp->rq_vers, 132 vers = rqstp->rq_vers,
133 proc = rqstp->rq_proc; 133 proc = rqstp->rq_proc;
134 unsigned long age; 134 unsigned long age;
@@ -258,7 +258,7 @@ found_entry:
258 * In this case, nfsd_cache_update is called with statp == NULL. 258 * In this case, nfsd_cache_update is called with statp == NULL.
259 */ 259 */
260void 260void
261nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, u32 *statp) 261nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp)
262{ 262{
263 struct svc_cacherep *rp; 263 struct svc_cacherep *rp;
264 struct kvec *resv = &rqstp->rq_res.head[0], *cachv; 264 struct kvec *resv = &rqstp->rq_res.head[0], *cachv;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 501d83884530..727ab3bd450d 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -76,7 +76,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
76 * comment in the NFSv3 spec says this is incorrect (implementation notes for 76 * comment in the NFSv3 spec says this is incorrect (implementation notes for
77 * the write call). 77 * the write call).
78 */ 78 */
79static inline int 79static inline __be32
80nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) 80nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
81{ 81{
82 /* Type can be negative when creating hardlinks - not to a dir */ 82 /* Type can be negative when creating hardlinks - not to a dir */
@@ -110,13 +110,13 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
110 * This is only called at the start of an nfsproc call, so fhp points to 110 * This is only called at the start of an nfsproc call, so fhp points to
111 * a svc_fh which is all 0 except for the over-the-wire file handle. 111 * a svc_fh which is all 0 except for the over-the-wire file handle.
112 */ 112 */
113u32 113__be32
114fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) 114fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
115{ 115{
116 struct knfsd_fh *fh = &fhp->fh_handle; 116 struct knfsd_fh *fh = &fhp->fh_handle;
117 struct svc_export *exp = NULL; 117 struct svc_export *exp = NULL;
118 struct dentry *dentry; 118 struct dentry *dentry;
119 u32 error = 0; 119 __be32 error = 0;
120 120
121 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); 121 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp));
122 122
@@ -315,7 +315,7 @@ static inline void _fh_update_old(struct dentry *dentry,
315 fh->ofh_dirino = 0; 315 fh->ofh_dirino = 0;
316} 316}
317 317
318int 318__be32
319fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) 319fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh)
320{ 320{
321 /* ref_fh is a reference file handle. 321 /* ref_fh is a reference file handle.
@@ -451,7 +451,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
451 * Update file handle information after changing a dentry. 451 * Update file handle information after changing a dentry.
452 * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create 452 * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create
453 */ 453 */
454int 454__be32
455fh_update(struct svc_fh *fhp) 455fh_update(struct svc_fh *fhp)
456{ 456{
457 struct dentry *dentry; 457 struct dentry *dentry;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 9ee1dab5d44a..ec983b777680 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -30,22 +30,22 @@ typedef struct svc_buf svc_buf;
30#define NFSDDBG_FACILITY NFSDDBG_PROC 30#define NFSDDBG_FACILITY NFSDDBG_PROC
31 31
32 32
33static int 33static __be32
34nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 34nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
35{ 35{
36 return nfs_ok; 36 return nfs_ok;
37} 37}
38 38
39static int 39static __be32
40nfsd_return_attrs(int err, struct nfsd_attrstat *resp) 40nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
41{ 41{
42 if (err) return err; 42 if (err) return err;
43 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 43 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
44 resp->fh.fh_dentry, 44 resp->fh.fh_dentry,
45 &resp->stat)); 45 &resp->stat));
46} 46}
47static int 47static __be32
48nfsd_return_dirop(int err, struct nfsd_diropres *resp) 48nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
49{ 49{
50 if (err) return err; 50 if (err) return err;
51 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 51 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
@@ -56,11 +56,11 @@ nfsd_return_dirop(int err, struct nfsd_diropres *resp)
56 * Get a file's attributes 56 * Get a file's attributes
57 * N.B. After this call resp->fh needs an fh_put 57 * N.B. After this call resp->fh needs an fh_put
58 */ 58 */
59static int 59static __be32
60nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 60nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
61 struct nfsd_attrstat *resp) 61 struct nfsd_attrstat *resp)
62{ 62{
63 int nfserr; 63 __be32 nfserr;
64 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 64 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
65 65
66 fh_copy(&resp->fh, &argp->fh); 66 fh_copy(&resp->fh, &argp->fh);
@@ -72,11 +72,11 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
72 * Set a file's attributes 72 * Set a file's attributes
73 * N.B. After this call resp->fh needs an fh_put 73 * N.B. After this call resp->fh needs an fh_put
74 */ 74 */
75static int 75static __be32
76nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, 76nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
77 struct nfsd_attrstat *resp) 77 struct nfsd_attrstat *resp)
78{ 78{
79 int nfserr; 79 __be32 nfserr;
80 dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", 80 dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n",
81 SVCFH_fmt(&argp->fh), 81 SVCFH_fmt(&argp->fh),
82 argp->attrs.ia_valid, (long) argp->attrs.ia_size); 82 argp->attrs.ia_valid, (long) argp->attrs.ia_size);
@@ -92,11 +92,11 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
92 * doesn't exist yet. 92 * doesn't exist yet.
93 * N.B. After this call resp->fh needs an fh_put 93 * N.B. After this call resp->fh needs an fh_put
94 */ 94 */
95static int 95static __be32
96nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 96nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
97 struct nfsd_diropres *resp) 97 struct nfsd_diropres *resp)
98{ 98{
99 int nfserr; 99 __be32 nfserr;
100 100
101 dprintk("nfsd: LOOKUP %s %.*s\n", 101 dprintk("nfsd: LOOKUP %s %.*s\n",
102 SVCFH_fmt(&argp->fh), argp->len, argp->name); 102 SVCFH_fmt(&argp->fh), argp->len, argp->name);
@@ -112,11 +112,11 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
112/* 112/*
113 * Read a symlink. 113 * Read a symlink.
114 */ 114 */
115static int 115static __be32
116nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, 116nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
117 struct nfsd_readlinkres *resp) 117 struct nfsd_readlinkres *resp)
118{ 118{
119 int nfserr; 119 __be32 nfserr;
120 120
121 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); 121 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh));
122 122
@@ -132,11 +132,11 @@ nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
132 * Read a portion of a file. 132 * Read a portion of a file.
133 * N.B. After this call resp->fh needs an fh_put 133 * N.B. After this call resp->fh needs an fh_put
134 */ 134 */
135static int 135static __be32
136nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, 136nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
137 struct nfsd_readres *resp) 137 struct nfsd_readres *resp)
138{ 138{
139 int nfserr; 139 __be32 nfserr;
140 140
141 dprintk("nfsd: READ %s %d bytes at %d\n", 141 dprintk("nfsd: READ %s %d bytes at %d\n",
142 SVCFH_fmt(&argp->fh), 142 SVCFH_fmt(&argp->fh),
@@ -172,11 +172,11 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
172 * Write data to a file 172 * Write data to a file
173 * N.B. After this call resp->fh needs an fh_put 173 * N.B. After this call resp->fh needs an fh_put
174 */ 174 */
175static int 175static __be32
176nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, 176nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
177 struct nfsd_attrstat *resp) 177 struct nfsd_attrstat *resp)
178{ 178{
179 int nfserr; 179 __be32 nfserr;
180 int stable = 1; 180 int stable = 1;
181 181
182 dprintk("nfsd: WRITE %s %d bytes at %d\n", 182 dprintk("nfsd: WRITE %s %d bytes at %d\n",
@@ -197,7 +197,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
197 * and the actual create() call in compliance with VFS protocols. 197 * and the actual create() call in compliance with VFS protocols.
198 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put 198 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put
199 */ 199 */
200static int 200static __be32
201nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 201nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
202 struct nfsd_diropres *resp) 202 struct nfsd_diropres *resp)
203{ 203{
@@ -206,7 +206,8 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
206 struct iattr *attr = &argp->attrs; 206 struct iattr *attr = &argp->attrs;
207 struct inode *inode; 207 struct inode *inode;
208 struct dentry *dchild; 208 struct dentry *dchild;
209 int nfserr, type, mode; 209 int type, mode;
210 __be32 nfserr;
210 dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); 211 dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size);
211 212
212 dprintk("nfsd: CREATE %s %.*s\n", 213 dprintk("nfsd: CREATE %s %.*s\n",
@@ -348,11 +349,11 @@ done:
348 return nfsd_return_dirop(nfserr, resp); 349 return nfsd_return_dirop(nfserr, resp);
349} 350}
350 351
351static int 352static __be32
352nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 353nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
353 void *resp) 354 void *resp)
354{ 355{
355 int nfserr; 356 __be32 nfserr;
356 357
357 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), 358 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh),
358 argp->len, argp->name); 359 argp->len, argp->name);
@@ -363,11 +364,11 @@ nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
363 return nfserr; 364 return nfserr;
364} 365}
365 366
366static int 367static __be32
367nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, 368nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
368 void *resp) 369 void *resp)
369{ 370{
370 int nfserr; 371 __be32 nfserr;
371 372
372 dprintk("nfsd: RENAME %s %.*s -> \n", 373 dprintk("nfsd: RENAME %s %.*s -> \n",
373 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); 374 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname);
@@ -381,11 +382,11 @@ nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
381 return nfserr; 382 return nfserr;
382} 383}
383 384
384static int 385static __be32
385nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, 386nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
386 void *resp) 387 void *resp)
387{ 388{
388 int nfserr; 389 __be32 nfserr;
389 390
390 dprintk("nfsd: LINK %s ->\n", 391 dprintk("nfsd: LINK %s ->\n",
391 SVCFH_fmt(&argp->ffh)); 392 SVCFH_fmt(&argp->ffh));
@@ -401,12 +402,12 @@ nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
401 return nfserr; 402 return nfserr;
402} 403}
403 404
404static int 405static __be32
405nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, 406nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
406 void *resp) 407 void *resp)
407{ 408{
408 struct svc_fh newfh; 409 struct svc_fh newfh;
409 int nfserr; 410 __be32 nfserr;
410 411
411 dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", 412 dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n",
412 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, 413 SVCFH_fmt(&argp->ffh), argp->flen, argp->fname,
@@ -430,11 +431,11 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
430 * Make directory. This operation is not idempotent. 431 * Make directory. This operation is not idempotent.
431 * N.B. After this call resp->fh needs an fh_put 432 * N.B. After this call resp->fh needs an fh_put
432 */ 433 */
433static int 434static __be32
434nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 435nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
435 struct nfsd_diropres *resp) 436 struct nfsd_diropres *resp)
436{ 437{
437 int nfserr; 438 __be32 nfserr;
438 439
439 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 440 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
440 441
@@ -454,11 +455,11 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
454/* 455/*
455 * Remove a directory 456 * Remove a directory
456 */ 457 */
457static int 458static __be32
458nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 459nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
459 void *resp) 460 void *resp)
460{ 461{
461 int nfserr; 462 __be32 nfserr;
462 463
463 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 464 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
464 465
@@ -470,11 +471,12 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
470/* 471/*
471 * Read a portion of a directory. 472 * Read a portion of a directory.
472 */ 473 */
473static int 474static __be32
474nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, 475nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
475 struct nfsd_readdirres *resp) 476 struct nfsd_readdirres *resp)
476{ 477{
477 int nfserr, count; 478 int count;
479 __be32 nfserr;
478 loff_t offset; 480 loff_t offset;
479 481
480 dprintk("nfsd: READDIR %s %d bytes at %d\n", 482 dprintk("nfsd: READDIR %s %d bytes at %d\n",
@@ -509,11 +511,11 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
509/* 511/*
510 * Get file system info 512 * Get file system info
511 */ 513 */
512static int 514static __be32
513nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 515nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
514 struct nfsd_statfsres *resp) 516 struct nfsd_statfsres *resp)
515{ 517{
516 int nfserr; 518 __be32 nfserr;
517 519
518 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); 520 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
519 521
@@ -579,11 +581,11 @@ struct svc_version nfsd_version2 = {
579/* 581/*
580 * Map errnos to NFS errnos. 582 * Map errnos to NFS errnos.
581 */ 583 */
582int 584__be32
583nfserrno (int errno) 585nfserrno (int errno)
584{ 586{
585 static struct { 587 static struct {
586 int nfserr; 588 __be32 nfserr;
587 int syserr; 589 int syserr;
588 } nfs_errtbl[] = { 590 } nfs_errtbl[] = {
589 { nfs_ok, 0 }, 591 { nfs_ok, 0 },
@@ -615,11 +617,10 @@ nfserrno (int errno)
615 { nfserr_badname, -ESRCH }, 617 { nfserr_badname, -ESRCH },
616 { nfserr_io, -ETXTBSY }, 618 { nfserr_io, -ETXTBSY },
617 { nfserr_notsupp, -EOPNOTSUPP }, 619 { nfserr_notsupp, -EOPNOTSUPP },
618 { -1, -EIO }
619 }; 620 };
620 int i; 621 int i;
621 622
622 for (i = 0; nfs_errtbl[i].nfserr != -1; i++) { 623 for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
623 if (nfs_errtbl[i].syserr == errno) 624 if (nfs_errtbl[i].syserr == errno)
624 return nfs_errtbl[i].nfserr; 625 return nfs_errtbl[i].nfserr;
625 } 626 }
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 013b38996e64..0aaccb03bf76 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -491,12 +491,12 @@ out:
491} 491}
492 492
493int 493int
494nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp) 494nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
495{ 495{
496 struct svc_procedure *proc; 496 struct svc_procedure *proc;
497 kxdrproc_t xdr; 497 kxdrproc_t xdr;
498 u32 nfserr; 498 __be32 nfserr;
499 u32 *nfserrp; 499 __be32 *nfserrp;
500 500
501 dprintk("nfsd_dispatch: vers %d proc %d\n", 501 dprintk("nfsd_dispatch: vers %d proc %d\n",
502 rqstp->rq_vers, rqstp->rq_proc); 502 rqstp->rq_vers, rqstp->rq_proc);
@@ -515,7 +515,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
515 515
516 /* Decode arguments */ 516 /* Decode arguments */
517 xdr = proc->pc_decode; 517 xdr = proc->pc_decode;
518 if (xdr && !xdr(rqstp, (u32*)rqstp->rq_arg.head[0].iov_base, 518 if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base,
519 rqstp->rq_argp)) { 519 rqstp->rq_argp)) {
520 dprintk("nfsd: failed to decode arguments!\n"); 520 dprintk("nfsd: failed to decode arguments!\n");
521 nfsd_cache_update(rqstp, RC_NOCACHE, NULL); 521 nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
@@ -528,7 +528,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
528 */ 528 */
529 nfserrp = rqstp->rq_res.head[0].iov_base 529 nfserrp = rqstp->rq_res.head[0].iov_base
530 + rqstp->rq_res.head[0].iov_len; 530 + rqstp->rq_res.head[0].iov_len;
531 rqstp->rq_res.head[0].iov_len += sizeof(u32); 531 rqstp->rq_res.head[0].iov_len += sizeof(__be32);
532 532
533 /* Now call the procedure handler, and encode NFS status. */ 533 /* Now call the procedure handler, and encode NFS status. */
534 nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 534 nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 1135c0d14557..56ebb1443e0e 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -37,8 +37,8 @@ static u32 nfs_ftypes[] = {
37/* 37/*
38 * XDR functions for basic NFS types 38 * XDR functions for basic NFS types
39 */ 39 */
40static u32 * 40static __be32 *
41decode_fh(u32 *p, struct svc_fh *fhp) 41decode_fh(__be32 *p, struct svc_fh *fhp)
42{ 42{
43 fh_init(fhp, NFS_FHSIZE); 43 fh_init(fhp, NFS_FHSIZE);
44 memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE); 44 memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE);
@@ -50,13 +50,13 @@ decode_fh(u32 *p, struct svc_fh *fhp)
50} 50}
51 51
52/* Helper function for NFSv2 ACL code */ 52/* Helper function for NFSv2 ACL code */
53u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp) 53__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp)
54{ 54{
55 return decode_fh(p, fhp); 55 return decode_fh(p, fhp);
56} 56}
57 57
58static inline u32 * 58static inline __be32 *
59encode_fh(u32 *p, struct svc_fh *fhp) 59encode_fh(__be32 *p, struct svc_fh *fhp)
60{ 60{
61 memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE); 61 memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE);
62 return p + (NFS_FHSIZE>> 2); 62 return p + (NFS_FHSIZE>> 2);
@@ -66,8 +66,8 @@ encode_fh(u32 *p, struct svc_fh *fhp)
66 * Decode a file name and make sure that the path contains 66 * Decode a file name and make sure that the path contains
67 * no slashes or null bytes. 67 * no slashes or null bytes.
68 */ 68 */
69static inline u32 * 69static inline __be32 *
70decode_filename(u32 *p, char **namp, int *lenp) 70decode_filename(__be32 *p, char **namp, int *lenp)
71{ 71{
72 char *name; 72 char *name;
73 int i; 73 int i;
@@ -82,8 +82,8 @@ decode_filename(u32 *p, char **namp, int *lenp)
82 return p; 82 return p;
83} 83}
84 84
85static inline u32 * 85static inline __be32 *
86decode_pathname(u32 *p, char **namp, int *lenp) 86decode_pathname(__be32 *p, char **namp, int *lenp)
87{ 87{
88 char *name; 88 char *name;
89 int i; 89 int i;
@@ -98,8 +98,8 @@ decode_pathname(u32 *p, char **namp, int *lenp)
98 return p; 98 return p;
99} 99}
100 100
101static inline u32 * 101static inline __be32 *
102decode_sattr(u32 *p, struct iattr *iap) 102decode_sattr(__be32 *p, struct iattr *iap)
103{ 103{
104 u32 tmp, tmp1; 104 u32 tmp, tmp1;
105 105
@@ -151,8 +151,8 @@ decode_sattr(u32 *p, struct iattr *iap)
151 return p; 151 return p;
152} 152}
153 153
154static u32 * 154static __be32 *
155encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, 155encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
156 struct kstat *stat) 156 struct kstat *stat)
157{ 157{
158 struct dentry *dentry = fhp->fh_dentry; 158 struct dentry *dentry = fhp->fh_dentry;
@@ -195,7 +195,7 @@ encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp,
195} 195}
196 196
197/* Helper function for NFSv2 ACL code */ 197/* Helper function for NFSv2 ACL code */
198u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) 198__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
199{ 199{
200 struct kstat stat; 200 struct kstat stat;
201 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); 201 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat);
@@ -206,13 +206,13 @@ u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
206 * XDR decode functions 206 * XDR decode functions
207 */ 207 */
208int 208int
209nfssvc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 209nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
210{ 210{
211 return xdr_argsize_check(rqstp, p); 211 return xdr_argsize_check(rqstp, p);
212} 212}
213 213
214int 214int
215nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) 215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
216{ 216{
217 if (!(p = decode_fh(p, &args->fh))) 217 if (!(p = decode_fh(p, &args->fh)))
218 return 0; 218 return 0;
@@ -220,7 +220,7 @@ nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args)
220} 220}
221 221
222int 222int
223nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, 223nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
224 struct nfsd_sattrargs *args) 224 struct nfsd_sattrargs *args)
225{ 225{
226 if (!(p = decode_fh(p, &args->fh)) 226 if (!(p = decode_fh(p, &args->fh))
@@ -231,7 +231,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p,
231} 231}
232 232
233int 233int
234nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, 234nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
235 struct nfsd_diropargs *args) 235 struct nfsd_diropargs *args)
236{ 236{
237 if (!(p = decode_fh(p, &args->fh)) 237 if (!(p = decode_fh(p, &args->fh))
@@ -242,7 +242,7 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p,
242} 242}
243 243
244int 244int
245nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, 245nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
246 struct nfsd_readargs *args) 246 struct nfsd_readargs *args)
247{ 247{
248 unsigned int len; 248 unsigned int len;
@@ -273,7 +273,7 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
273} 273}
274 274
275int 275int
276nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, 276nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
277 struct nfsd_writeargs *args) 277 struct nfsd_writeargs *args)
278{ 278{
279 unsigned int len; 279 unsigned int len;
@@ -303,7 +303,7 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
303} 303}
304 304
305int 305int
306nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p, 306nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
307 struct nfsd_createargs *args) 307 struct nfsd_createargs *args)
308{ 308{
309 if (!(p = decode_fh(p, &args->fh)) 309 if (!(p = decode_fh(p, &args->fh))
@@ -315,7 +315,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p,
315} 315}
316 316
317int 317int
318nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, 318nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
319 struct nfsd_renameargs *args) 319 struct nfsd_renameargs *args)
320{ 320{
321 if (!(p = decode_fh(p, &args->ffh)) 321 if (!(p = decode_fh(p, &args->ffh))
@@ -328,7 +328,7 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p,
328} 328}
329 329
330int 330int
331nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinkargs *args) 331nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args)
332{ 332{
333 if (!(p = decode_fh(p, &args->fh))) 333 if (!(p = decode_fh(p, &args->fh)))
334 return 0; 334 return 0;
@@ -338,7 +338,7 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinka
338} 338}
339 339
340int 340int
341nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, 341nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
342 struct nfsd_linkargs *args) 342 struct nfsd_linkargs *args)
343{ 343{
344 if (!(p = decode_fh(p, &args->ffh)) 344 if (!(p = decode_fh(p, &args->ffh))
@@ -350,7 +350,7 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p,
350} 350}
351 351
352int 352int
353nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, 353nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
354 struct nfsd_symlinkargs *args) 354 struct nfsd_symlinkargs *args)
355{ 355{
356 if (!(p = decode_fh(p, &args->ffh)) 356 if (!(p = decode_fh(p, &args->ffh))
@@ -363,7 +363,7 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
363} 363}
364 364
365int 365int
366nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, 366nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
367 struct nfsd_readdirargs *args) 367 struct nfsd_readdirargs *args)
368{ 368{
369 if (!(p = decode_fh(p, &args->fh))) 369 if (!(p = decode_fh(p, &args->fh)))
@@ -382,13 +382,13 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
382 * XDR encode functions 382 * XDR encode functions
383 */ 383 */
384int 384int
385nfssvc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) 385nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
386{ 386{
387 return xdr_ressize_check(rqstp, p); 387 return xdr_ressize_check(rqstp, p);
388} 388}
389 389
390int 390int
391nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, 391nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
392 struct nfsd_attrstat *resp) 392 struct nfsd_attrstat *resp)
393{ 393{
394 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 394 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
@@ -396,7 +396,7 @@ nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p,
396} 396}
397 397
398int 398int
399nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p, 399nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
400 struct nfsd_diropres *resp) 400 struct nfsd_diropres *resp)
401{ 401{
402 p = encode_fh(p, &resp->fh); 402 p = encode_fh(p, &resp->fh);
@@ -405,7 +405,7 @@ nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p,
405} 405}
406 406
407int 407int
408nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, 408nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
409 struct nfsd_readlinkres *resp) 409 struct nfsd_readlinkres *resp)
410{ 410{
411 *p++ = htonl(resp->len); 411 *p++ = htonl(resp->len);
@@ -421,7 +421,7 @@ nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
421} 421}
422 422
423int 423int
424nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p, 424nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
425 struct nfsd_readres *resp) 425 struct nfsd_readres *resp)
426{ 426{
427 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 427 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
@@ -440,7 +440,7 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p,
440} 440}
441 441
442int 442int
443nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, 443nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
444 struct nfsd_readdirres *resp) 444 struct nfsd_readdirres *resp)
445{ 445{
446 xdr_ressize_check(rqstp, p); 446 xdr_ressize_check(rqstp, p);
@@ -453,7 +453,7 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
453} 453}
454 454
455int 455int
456nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, 456nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
457 struct nfsd_statfsres *resp) 457 struct nfsd_statfsres *resp)
458{ 458{
459 struct kstatfs *stat = &resp->stats; 459 struct kstatfs *stat = &resp->stats;
@@ -471,7 +471,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
471 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 471 int namlen, loff_t offset, ino_t ino, unsigned int d_type)
472{ 472{
473 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); 473 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
474 u32 *p = cd->buffer; 474 __be32 *p = cd->buffer;
475 int buflen, slen; 475 int buflen, slen;
476 476
477 /* 477 /*
@@ -497,7 +497,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
497 *p++ = htonl((u32) ino); /* file id */ 497 *p++ = htonl((u32) ino); /* file id */
498 p = xdr_encode_array(p, name, namlen);/* name length & name */ 498 p = xdr_encode_array(p, name, namlen);/* name length & name */
499 cd->offset = p; /* remember pointer */ 499 cd->offset = p; /* remember pointer */
500 *p++ = ~(u32) 0; /* offset of next entry */ 500 *p++ = htonl(~0U); /* offset of next entry */
501 501
502 cd->buflen = buflen; 502 cd->buflen = buflen;
503 cd->buffer = p; 503 cd->buffer = p;
@@ -509,7 +509,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
509 * XDR release functions 509 * XDR release functions
510 */ 510 */
511int 511int
512nfssvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, 512nfssvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p,
513 struct nfsd_fhandle *resp) 513 struct nfsd_fhandle *resp)
514{ 514{
515 fh_put(&resp->fh); 515 fh_put(&resp->fh);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1141bd29e4e3..f21e917bb8ed 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -110,7 +110,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
110 struct dentry *dentry = *dpp; 110 struct dentry *dentry = *dpp;
111 struct vfsmount *mnt = mntget(exp->ex_mnt); 111 struct vfsmount *mnt = mntget(exp->ex_mnt);
112 struct dentry *mounts = dget(dentry); 112 struct dentry *mounts = dget(dentry);
113 int err = nfs_ok; 113 int err = 0;
114 114
115 while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)); 115 while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts));
116 116
@@ -148,14 +148,15 @@ out:
148 * clients and is explicitly disallowed for NFSv3 148 * clients and is explicitly disallowed for NFSv3
149 * NeilBrown <neilb@cse.unsw.edu.au> 149 * NeilBrown <neilb@cse.unsw.edu.au>
150 */ 150 */
151int 151__be32
152nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, 152nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
153 int len, struct svc_fh *resfh) 153 int len, struct svc_fh *resfh)
154{ 154{
155 struct svc_export *exp; 155 struct svc_export *exp;
156 struct dentry *dparent; 156 struct dentry *dparent;
157 struct dentry *dentry; 157 struct dentry *dentry;
158 int err; 158 __be32 err;
159 int host_err;
159 160
160 dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); 161 dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
161 162
@@ -193,7 +194,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
193 exp2 = exp_parent(exp->ex_client, mnt, dentry, 194 exp2 = exp_parent(exp->ex_client, mnt, dentry,
194 &rqstp->rq_chandle); 195 &rqstp->rq_chandle);
195 if (IS_ERR(exp2)) { 196 if (IS_ERR(exp2)) {
196 err = PTR_ERR(exp2); 197 host_err = PTR_ERR(exp2);
197 dput(dentry); 198 dput(dentry);
198 mntput(mnt); 199 mntput(mnt);
199 goto out_nfserr; 200 goto out_nfserr;
@@ -210,14 +211,14 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
210 } else { 211 } else {
211 fh_lock(fhp); 212 fh_lock(fhp);
212 dentry = lookup_one_len(name, dparent, len); 213 dentry = lookup_one_len(name, dparent, len);
213 err = PTR_ERR(dentry); 214 host_err = PTR_ERR(dentry);
214 if (IS_ERR(dentry)) 215 if (IS_ERR(dentry))
215 goto out_nfserr; 216 goto out_nfserr;
216 /* 217 /*
217 * check if we have crossed a mount point ... 218 * check if we have crossed a mount point ...
218 */ 219 */
219 if (d_mountpoint(dentry)) { 220 if (d_mountpoint(dentry)) {
220 if ((err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { 221 if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) {
221 dput(dentry); 222 dput(dentry);
222 goto out_nfserr; 223 goto out_nfserr;
223 } 224 }
@@ -236,7 +237,7 @@ out:
236 return err; 237 return err;
237 238
238out_nfserr: 239out_nfserr:
239 err = nfserrno(err); 240 err = nfserrno(host_err);
240 goto out; 241 goto out;
241} 242}
242 243
@@ -244,7 +245,7 @@ out_nfserr:
244 * Set various file attributes. 245 * Set various file attributes.
245 * N.B. After this call fhp needs an fh_put 246 * N.B. After this call fhp needs an fh_put
246 */ 247 */
247int 248__be32
248nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, 249nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
249 int check_guard, time_t guardtime) 250 int check_guard, time_t guardtime)
250{ 251{
@@ -253,7 +254,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
253 int accmode = MAY_SATTR; 254 int accmode = MAY_SATTR;
254 int ftype = 0; 255 int ftype = 0;
255 int imode; 256 int imode;
256 int err; 257 __be32 err;
258 int host_err;
257 int size_change = 0; 259 int size_change = 0;
258 260
259 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) 261 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
@@ -319,19 +321,19 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
319 * If we are changing the size of the file, then 321 * If we are changing the size of the file, then
320 * we need to break all leases. 322 * we need to break all leases.
321 */ 323 */
322 err = break_lease(inode, FMODE_WRITE | O_NONBLOCK); 324 host_err = break_lease(inode, FMODE_WRITE | O_NONBLOCK);
323 if (err == -EWOULDBLOCK) 325 if (host_err == -EWOULDBLOCK)
324 err = -ETIMEDOUT; 326 host_err = -ETIMEDOUT;
325 if (err) /* ENOMEM or EWOULDBLOCK */ 327 if (host_err) /* ENOMEM or EWOULDBLOCK */
326 goto out_nfserr; 328 goto out_nfserr;
327 329
328 err = get_write_access(inode); 330 host_err = get_write_access(inode);
329 if (err) 331 if (host_err)
330 goto out_nfserr; 332 goto out_nfserr;
331 333
332 size_change = 1; 334 size_change = 1;
333 err = locks_verify_truncate(inode, NULL, iap->ia_size); 335 host_err = locks_verify_truncate(inode, NULL, iap->ia_size);
334 if (err) { 336 if (host_err) {
335 put_write_access(inode); 337 put_write_access(inode);
336 goto out_nfserr; 338 goto out_nfserr;
337 } 339 }
@@ -357,8 +359,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
357 err = nfserr_notsync; 359 err = nfserr_notsync;
358 if (!check_guard || guardtime == inode->i_ctime.tv_sec) { 360 if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
359 fh_lock(fhp); 361 fh_lock(fhp);
360 err = notify_change(dentry, iap); 362 host_err = notify_change(dentry, iap);
361 err = nfserrno(err); 363 err = nfserrno(host_err);
362 fh_unlock(fhp); 364 fh_unlock(fhp);
363 } 365 }
364 if (size_change) 366 if (size_change)
@@ -370,7 +372,7 @@ out:
370 return err; 372 return err;
371 373
372out_nfserr: 374out_nfserr:
373 err = nfserrno(err); 375 err = nfserrno(host_err);
374 goto out; 376 goto out;
375} 377}
376 378
@@ -420,11 +422,12 @@ out:
420 return error; 422 return error;
421} 423}
422 424
423int 425__be32
424nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, 426nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
425 struct nfs4_acl *acl) 427 struct nfs4_acl *acl)
426{ 428{
427 int error; 429 __be32 error;
430 int host_error;
428 struct dentry *dentry; 431 struct dentry *dentry;
429 struct inode *inode; 432 struct inode *inode;
430 struct posix_acl *pacl = NULL, *dpacl = NULL; 433 struct posix_acl *pacl = NULL, *dpacl = NULL;
@@ -440,20 +443,20 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
440 if (S_ISDIR(inode->i_mode)) 443 if (S_ISDIR(inode->i_mode))
441 flags = NFS4_ACL_DIR; 444 flags = NFS4_ACL_DIR;
442 445
443 error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags); 446 host_error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags);
444 if (error == -EINVAL) { 447 if (host_error == -EINVAL) {
445 error = nfserr_attrnotsupp; 448 error = nfserr_attrnotsupp;
446 goto out; 449 goto out;
447 } else if (error < 0) 450 } else if (host_error < 0)
448 goto out_nfserr; 451 goto out_nfserr;
449 452
450 error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); 453 host_error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
451 if (error < 0) 454 if (host_error < 0)
452 goto out_nfserr; 455 goto out_nfserr;
453 456
454 if (S_ISDIR(inode->i_mode)) { 457 if (S_ISDIR(inode->i_mode)) {
455 error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); 458 host_error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
456 if (error < 0) 459 if (host_error < 0)
457 goto out_nfserr; 460 goto out_nfserr;
458 } 461 }
459 462
@@ -464,7 +467,7 @@ out:
464 posix_acl_release(dpacl); 467 posix_acl_release(dpacl);
465 return (error); 468 return (error);
466out_nfserr: 469out_nfserr:
467 error = nfserrno(error); 470 error = nfserrno(host_error);
468 goto out; 471 goto out;
469} 472}
470 473
@@ -571,14 +574,14 @@ static struct accessmap nfs3_anyaccess[] = {
571 { 0, 0 } 574 { 0, 0 }
572}; 575};
573 576
574int 577__be32
575nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported) 578nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported)
576{ 579{
577 struct accessmap *map; 580 struct accessmap *map;
578 struct svc_export *export; 581 struct svc_export *export;
579 struct dentry *dentry; 582 struct dentry *dentry;
580 u32 query, result = 0, sresult = 0; 583 u32 query, result = 0, sresult = 0;
581 unsigned int error; 584 __be32 error;
582 585
583 error = fh_verify(rqstp, fhp, 0, MAY_NOP); 586 error = fh_verify(rqstp, fhp, 0, MAY_NOP);
584 if (error) 587 if (error)
@@ -598,7 +601,7 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
598 query = *access; 601 query = *access;
599 for (; map->access; map++) { 602 for (; map->access; map++) {
600 if (map->access & query) { 603 if (map->access & query) {
601 unsigned int err2; 604 __be32 err2;
602 605
603 sresult |= map->access; 606 sresult |= map->access;
604 607
@@ -637,13 +640,15 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
637 * The access argument indicates the type of open (read/write/lock) 640 * The access argument indicates the type of open (read/write/lock)
638 * N.B. After this call fhp needs an fh_put 641 * N.B. After this call fhp needs an fh_put
639 */ 642 */
640int 643__be32
641nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, 644nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
642 int access, struct file **filp) 645 int access, struct file **filp)
643{ 646{
644 struct dentry *dentry; 647 struct dentry *dentry;
645 struct inode *inode; 648 struct inode *inode;
646 int flags = O_RDONLY|O_LARGEFILE, err; 649 int flags = O_RDONLY|O_LARGEFILE;
650 __be32 err;
651 int host_err;
647 652
648 /* 653 /*
649 * If we get here, then the client has already done an "open", 654 * If we get here, then the client has already done an "open",
@@ -673,10 +678,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
673 * Check to see if there are any leases on this file. 678 * Check to see if there are any leases on this file.
674 * This may block while leases are broken. 679 * This may block while leases are broken.
675 */ 680 */
676 err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0)); 681 host_err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0));
677 if (err == -EWOULDBLOCK) 682 if (host_err == -EWOULDBLOCK)
678 err = -ETIMEDOUT; 683 host_err = -ETIMEDOUT;
679 if (err) /* NOMEM or WOULDBLOCK */ 684 if (host_err) /* NOMEM or WOULDBLOCK */
680 goto out_nfserr; 685 goto out_nfserr;
681 686
682 if (access & MAY_WRITE) { 687 if (access & MAY_WRITE) {
@@ -689,10 +694,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
689 } 694 }
690 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); 695 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags);
691 if (IS_ERR(*filp)) 696 if (IS_ERR(*filp))
692 err = PTR_ERR(*filp); 697 host_err = PTR_ERR(*filp);
693out_nfserr: 698out_nfserr:
694 if (err) 699 err = nfserrno(host_err);
695 err = nfserrno(err);
696out: 700out:
697 return err; 701 return err;
698} 702}
@@ -830,14 +834,15 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
830 return size; 834 return size;
831} 835}
832 836
833static int 837static __be32
834nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 838nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
835 loff_t offset, struct kvec *vec, int vlen, unsigned long *count) 839 loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
836{ 840{
837 struct inode *inode; 841 struct inode *inode;
838 struct raparms *ra; 842 struct raparms *ra;
839 mm_segment_t oldfs; 843 mm_segment_t oldfs;
840 int err; 844 __be32 err;
845 int host_err;
841 846
842 err = nfserr_perm; 847 err = nfserr_perm;
843 inode = file->f_dentry->d_inode; 848 inode = file->f_dentry->d_inode;
@@ -855,12 +860,12 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
855 860
856 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { 861 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) {
857 rqstp->rq_resused = 1; 862 rqstp->rq_resused = 1;
858 err = file->f_op->sendfile(file, &offset, *count, 863 host_err = file->f_op->sendfile(file, &offset, *count,
859 nfsd_read_actor, rqstp); 864 nfsd_read_actor, rqstp);
860 } else { 865 } else {
861 oldfs = get_fs(); 866 oldfs = get_fs();
862 set_fs(KERNEL_DS); 867 set_fs(KERNEL_DS);
863 err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset); 868 host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset);
864 set_fs(oldfs); 869 set_fs(oldfs);
865 } 870 }
866 871
@@ -874,13 +879,13 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
874 spin_unlock(&rab->pb_lock); 879 spin_unlock(&rab->pb_lock);
875 } 880 }
876 881
877 if (err >= 0) { 882 if (host_err >= 0) {
878 nfsdstats.io_read += err; 883 nfsdstats.io_read += host_err;
879 *count = err; 884 *count = host_err;
880 err = 0; 885 err = 0;
881 fsnotify_access(file->f_dentry); 886 fsnotify_access(file->f_dentry);
882 } else 887 } else
883 err = nfserrno(err); 888 err = nfserrno(host_err);
884out: 889out:
885 return err; 890 return err;
886} 891}
@@ -895,7 +900,7 @@ static void kill_suid(struct dentry *dentry)
895 mutex_unlock(&dentry->d_inode->i_mutex); 900 mutex_unlock(&dentry->d_inode->i_mutex);
896} 901}
897 902
898static int 903static __be32
899nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 904nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
900 loff_t offset, struct kvec *vec, int vlen, 905 loff_t offset, struct kvec *vec, int vlen,
901 unsigned long cnt, int *stablep) 906 unsigned long cnt, int *stablep)
@@ -904,7 +909,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
904 struct dentry *dentry; 909 struct dentry *dentry;
905 struct inode *inode; 910 struct inode *inode;
906 mm_segment_t oldfs; 911 mm_segment_t oldfs;
907 int err = 0; 912 __be32 err = 0;
913 int host_err;
908 int stable = *stablep; 914 int stable = *stablep;
909 915
910#ifdef MSNFS 916#ifdef MSNFS
@@ -940,18 +946,18 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
940 946
941 /* Write the data. */ 947 /* Write the data. */
942 oldfs = get_fs(); set_fs(KERNEL_DS); 948 oldfs = get_fs(); set_fs(KERNEL_DS);
943 err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); 949 host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
944 set_fs(oldfs); 950 set_fs(oldfs);
945 if (err >= 0) { 951 if (host_err >= 0) {
946 nfsdstats.io_write += cnt; 952 nfsdstats.io_write += cnt;
947 fsnotify_modify(file->f_dentry); 953 fsnotify_modify(file->f_dentry);
948 } 954 }
949 955
950 /* clear setuid/setgid flag after write */ 956 /* clear setuid/setgid flag after write */
951 if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) 957 if (host_err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID)))
952 kill_suid(dentry); 958 kill_suid(dentry);
953 959
954 if (err >= 0 && stable) { 960 if (host_err >= 0 && stable) {
955 static ino_t last_ino; 961 static ino_t last_ino;
956 static dev_t last_dev; 962 static dev_t last_dev;
957 963
@@ -977,7 +983,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
977 983
978 if (inode->i_state & I_DIRTY) { 984 if (inode->i_state & I_DIRTY) {
979 dprintk("nfsd: write sync %d\n", current->pid); 985 dprintk("nfsd: write sync %d\n", current->pid);
980 err=nfsd_sync(file); 986 host_err=nfsd_sync(file);
981 } 987 }
982#if 0 988#if 0
983 wake_up(&inode->i_wait); 989 wake_up(&inode->i_wait);
@@ -987,11 +993,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
987 last_dev = inode->i_sb->s_dev; 993 last_dev = inode->i_sb->s_dev;
988 } 994 }
989 995
990 dprintk("nfsd: write complete err=%d\n", err); 996 dprintk("nfsd: write complete host_err=%d\n", host_err);
991 if (err >= 0) 997 if (host_err >= 0)
992 err = 0; 998 err = 0;
993 else 999 else
994 err = nfserrno(err); 1000 err = nfserrno(host_err);
995out: 1001out:
996 return err; 1002 return err;
997} 1003}
@@ -1001,12 +1007,12 @@ out:
1001 * on entry. On return, *count contains the number of bytes actually read. 1007 * on entry. On return, *count contains the number of bytes actually read.
1002 * N.B. After this call fhp needs an fh_put 1008 * N.B. After this call fhp needs an fh_put
1003 */ 1009 */
1004int 1010__be32
1005nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 1011nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1006 loff_t offset, struct kvec *vec, int vlen, 1012 loff_t offset, struct kvec *vec, int vlen,
1007 unsigned long *count) 1013 unsigned long *count)
1008{ 1014{
1009 int err; 1015 __be32 err;
1010 1016
1011 if (file) { 1017 if (file) {
1012 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, 1018 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry,
@@ -1030,12 +1036,12 @@ out:
1030 * The stable flag requests synchronous writes. 1036 * The stable flag requests synchronous writes.
1031 * N.B. After this call fhp needs an fh_put 1037 * N.B. After this call fhp needs an fh_put
1032 */ 1038 */
1033int 1039__be32
1034nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, 1040nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1035 loff_t offset, struct kvec *vec, int vlen, unsigned long cnt, 1041 loff_t offset, struct kvec *vec, int vlen, unsigned long cnt,
1036 int *stablep) 1042 int *stablep)
1037{ 1043{
1038 int err = 0; 1044 __be32 err = 0;
1039 1045
1040 if (file) { 1046 if (file) {
1041 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, 1047 err = nfsd_permission(fhp->fh_export, fhp->fh_dentry,
@@ -1067,12 +1073,12 @@ out:
1067 * Unfortunately we cannot lock the file to make sure we return full WCC 1073 * Unfortunately we cannot lock the file to make sure we return full WCC
1068 * data to the client, as locking happens lower down in the filesystem. 1074 * data to the client, as locking happens lower down in the filesystem.
1069 */ 1075 */
1070int 1076__be32
1071nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, 1077nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
1072 loff_t offset, unsigned long count) 1078 loff_t offset, unsigned long count)
1073{ 1079{
1074 struct file *file; 1080 struct file *file;
1075 int err; 1081 __be32 err;
1076 1082
1077 if ((u64)count > ~(u64)offset) 1083 if ((u64)count > ~(u64)offset)
1078 return nfserr_inval; 1084 return nfserr_inval;
@@ -1100,14 +1106,15 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
1100 * 1106 *
1101 * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp 1107 * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp
1102 */ 1108 */
1103int 1109__be32
1104nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, 1110nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1105 char *fname, int flen, struct iattr *iap, 1111 char *fname, int flen, struct iattr *iap,
1106 int type, dev_t rdev, struct svc_fh *resfhp) 1112 int type, dev_t rdev, struct svc_fh *resfhp)
1107{ 1113{
1108 struct dentry *dentry, *dchild = NULL; 1114 struct dentry *dentry, *dchild = NULL;
1109 struct inode *dirp; 1115 struct inode *dirp;
1110 int err; 1116 __be32 err;
1117 int host_err;
1111 1118
1112 err = nfserr_perm; 1119 err = nfserr_perm;
1113 if (!flen) 1120 if (!flen)
@@ -1134,7 +1141,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1134 /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ 1141 /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
1135 fh_lock_nested(fhp, I_MUTEX_PARENT); 1142 fh_lock_nested(fhp, I_MUTEX_PARENT);
1136 dchild = lookup_one_len(fname, dentry, flen); 1143 dchild = lookup_one_len(fname, dentry, flen);
1137 err = PTR_ERR(dchild); 1144 host_err = PTR_ERR(dchild);
1138 if (IS_ERR(dchild)) 1145 if (IS_ERR(dchild))
1139 goto out_nfserr; 1146 goto out_nfserr;
1140 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); 1147 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
@@ -1173,22 +1180,22 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1173 err = nfserr_perm; 1180 err = nfserr_perm;
1174 switch (type) { 1181 switch (type) {
1175 case S_IFREG: 1182 case S_IFREG:
1176 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 1183 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
1177 break; 1184 break;
1178 case S_IFDIR: 1185 case S_IFDIR:
1179 err = vfs_mkdir(dirp, dchild, iap->ia_mode); 1186 host_err = vfs_mkdir(dirp, dchild, iap->ia_mode);
1180 break; 1187 break;
1181 case S_IFCHR: 1188 case S_IFCHR:
1182 case S_IFBLK: 1189 case S_IFBLK:
1183 case S_IFIFO: 1190 case S_IFIFO:
1184 case S_IFSOCK: 1191 case S_IFSOCK:
1185 err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); 1192 host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
1186 break; 1193 break;
1187 default: 1194 default:
1188 printk("nfsd: bad file type %o in nfsd_create\n", type); 1195 printk("nfsd: bad file type %o in nfsd_create\n", type);
1189 err = -EINVAL; 1196 host_err = -EINVAL;
1190 } 1197 }
1191 if (err < 0) 1198 if (host_err < 0)
1192 goto out_nfserr; 1199 goto out_nfserr;
1193 1200
1194 if (EX_ISSYNC(fhp->fh_export)) { 1201 if (EX_ISSYNC(fhp->fh_export)) {
@@ -1203,7 +1210,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1203 * directories via NFS. 1210 * directories via NFS.
1204 */ 1211 */
1205 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) { 1212 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
1206 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1213 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1207 if (err2) 1214 if (err2)
1208 err = err2; 1215 err = err2;
1209 } 1216 }
@@ -1218,7 +1225,7 @@ out:
1218 return err; 1225 return err;
1219 1226
1220out_nfserr: 1227out_nfserr:
1221 err = nfserrno(err); 1228 err = nfserrno(host_err);
1222 goto out; 1229 goto out;
1223} 1230}
1224 1231
@@ -1226,7 +1233,7 @@ out_nfserr:
1226/* 1233/*
1227 * NFSv3 version of nfsd_create 1234 * NFSv3 version of nfsd_create
1228 */ 1235 */
1229int 1236__be32
1230nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, 1237nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1231 char *fname, int flen, struct iattr *iap, 1238 char *fname, int flen, struct iattr *iap,
1232 struct svc_fh *resfhp, int createmode, u32 *verifier, 1239 struct svc_fh *resfhp, int createmode, u32 *verifier,
@@ -1234,7 +1241,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1234{ 1241{
1235 struct dentry *dentry, *dchild = NULL; 1242 struct dentry *dentry, *dchild = NULL;
1236 struct inode *dirp; 1243 struct inode *dirp;
1237 int err; 1244 __be32 err;
1245 int host_err;
1238 __u32 v_mtime=0, v_atime=0; 1246 __u32 v_mtime=0, v_atime=0;
1239 int v_mode=0; 1247 int v_mode=0;
1240 1248
@@ -1264,7 +1272,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1264 * Compose the response file handle. 1272 * Compose the response file handle.
1265 */ 1273 */
1266 dchild = lookup_one_len(fname, dentry, flen); 1274 dchild = lookup_one_len(fname, dentry, flen);
1267 err = PTR_ERR(dchild); 1275 host_err = PTR_ERR(dchild);
1268 if (IS_ERR(dchild)) 1276 if (IS_ERR(dchild))
1269 goto out_nfserr; 1277 goto out_nfserr;
1270 1278
@@ -1320,8 +1328,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1320 goto out; 1328 goto out;
1321 } 1329 }
1322 1330
1323 err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 1331 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
1324 if (err < 0) 1332 if (host_err < 0)
1325 goto out_nfserr; 1333 goto out_nfserr;
1326 1334
1327 if (EX_ISSYNC(fhp->fh_export)) { 1335 if (EX_ISSYNC(fhp->fh_export)) {
@@ -1350,7 +1358,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1350 */ 1358 */
1351 set_attr: 1359 set_attr:
1352 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { 1360 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
1353 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1361 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1354 if (err2) 1362 if (err2)
1355 err = err2; 1363 err = err2;
1356 } 1364 }
@@ -1368,7 +1376,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1368 return err; 1376 return err;
1369 1377
1370 out_nfserr: 1378 out_nfserr:
1371 err = nfserrno(err); 1379 err = nfserrno(host_err);
1372 goto out; 1380 goto out;
1373} 1381}
1374#endif /* CONFIG_NFSD_V3 */ 1382#endif /* CONFIG_NFSD_V3 */
@@ -1378,13 +1386,14 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1378 * fits into the buffer. On return, it contains the true length. 1386 * fits into the buffer. On return, it contains the true length.
1379 * N.B. After this call fhp needs an fh_put 1387 * N.B. After this call fhp needs an fh_put
1380 */ 1388 */
1381int 1389__be32
1382nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) 1390nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1383{ 1391{
1384 struct dentry *dentry; 1392 struct dentry *dentry;
1385 struct inode *inode; 1393 struct inode *inode;
1386 mm_segment_t oldfs; 1394 mm_segment_t oldfs;
1387 int err; 1395 __be32 err;
1396 int host_err;
1388 1397
1389 err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP); 1398 err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP);
1390 if (err) 1399 if (err)
@@ -1403,18 +1412,18 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1403 */ 1412 */
1404 1413
1405 oldfs = get_fs(); set_fs(KERNEL_DS); 1414 oldfs = get_fs(); set_fs(KERNEL_DS);
1406 err = inode->i_op->readlink(dentry, buf, *lenp); 1415 host_err = inode->i_op->readlink(dentry, buf, *lenp);
1407 set_fs(oldfs); 1416 set_fs(oldfs);
1408 1417
1409 if (err < 0) 1418 if (host_err < 0)
1410 goto out_nfserr; 1419 goto out_nfserr;
1411 *lenp = err; 1420 *lenp = host_err;
1412 err = 0; 1421 err = 0;
1413out: 1422out:
1414 return err; 1423 return err;
1415 1424
1416out_nfserr: 1425out_nfserr:
1417 err = nfserrno(err); 1426 err = nfserrno(host_err);
1418 goto out; 1427 goto out;
1419} 1428}
1420 1429
@@ -1422,7 +1431,7 @@ out_nfserr:
1422 * Create a symlink and look up its inode 1431 * Create a symlink and look up its inode
1423 * N.B. After this call _both_ fhp and resfhp need an fh_put 1432 * N.B. After this call _both_ fhp and resfhp need an fh_put
1424 */ 1433 */
1425int 1434__be32
1426nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, 1435nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1427 char *fname, int flen, 1436 char *fname, int flen,
1428 char *path, int plen, 1437 char *path, int plen,
@@ -1430,7 +1439,8 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1430 struct iattr *iap) 1439 struct iattr *iap)
1431{ 1440{
1432 struct dentry *dentry, *dnew; 1441 struct dentry *dentry, *dnew;
1433 int err, cerr; 1442 __be32 err, cerr;
1443 int host_err;
1434 umode_t mode; 1444 umode_t mode;
1435 1445
1436 err = nfserr_noent; 1446 err = nfserr_noent;
@@ -1446,7 +1456,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1446 fh_lock(fhp); 1456 fh_lock(fhp);
1447 dentry = fhp->fh_dentry; 1457 dentry = fhp->fh_dentry;
1448 dnew = lookup_one_len(fname, dentry, flen); 1458 dnew = lookup_one_len(fname, dentry, flen);
1449 err = PTR_ERR(dnew); 1459 host_err = PTR_ERR(dnew);
1450 if (IS_ERR(dnew)) 1460 if (IS_ERR(dnew))
1451 goto out_nfserr; 1461 goto out_nfserr;
1452 1462
@@ -1458,21 +1468,21 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
1458 if (unlikely(path[plen] != 0)) { 1468 if (unlikely(path[plen] != 0)) {
1459 char *path_alloced = kmalloc(plen+1, GFP_KERNEL); 1469 char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
1460 if (path_alloced == NULL) 1470 if (path_alloced == NULL)
1461 err = -ENOMEM; 1471 host_err = -ENOMEM;
1462 else { 1472 else {
1463 strncpy(path_alloced, path, plen); 1473 strncpy(path_alloced, path, plen);
1464 path_alloced[plen] = 0; 1474 path_alloced[plen] = 0;
1465 err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); 1475 host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
1466 kfree(path_alloced); 1476 kfree(path_alloced);
1467 } 1477 }
1468 } else 1478 } else
1469 err = vfs_symlink(dentry->d_inode, dnew, path, mode); 1479 host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
1470 1480
1471 if (!err) 1481 if (!host_err) {
1472 if (EX_ISSYNC(fhp->fh_export)) 1482 if (EX_ISSYNC(fhp->fh_export))
1473 err = nfsd_sync_dir(dentry); 1483 host_err = nfsd_sync_dir(dentry);
1474 if (err) 1484 }
1475 err = nfserrno(err); 1485 err = nfserrno(host_err);
1476 fh_unlock(fhp); 1486 fh_unlock(fhp);
1477 1487
1478 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); 1488 cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
@@ -1482,7 +1492,7 @@ out:
1482 return err; 1492 return err;
1483 1493
1484out_nfserr: 1494out_nfserr:
1485 err = nfserrno(err); 1495 err = nfserrno(host_err);
1486 goto out; 1496 goto out;
1487} 1497}
1488 1498
@@ -1490,13 +1500,14 @@ out_nfserr:
1490 * Create a hardlink 1500 * Create a hardlink
1491 * N.B. After this call _both_ ffhp and tfhp need an fh_put 1501 * N.B. After this call _both_ ffhp and tfhp need an fh_put
1492 */ 1502 */
1493int 1503__be32
1494nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, 1504nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1495 char *name, int len, struct svc_fh *tfhp) 1505 char *name, int len, struct svc_fh *tfhp)
1496{ 1506{
1497 struct dentry *ddir, *dnew, *dold; 1507 struct dentry *ddir, *dnew, *dold;
1498 struct inode *dirp, *dest; 1508 struct inode *dirp, *dest;
1499 int err; 1509 __be32 err;
1510 int host_err;
1500 1511
1501 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); 1512 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE);
1502 if (err) 1513 if (err)
@@ -1517,24 +1528,25 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1517 dirp = ddir->d_inode; 1528 dirp = ddir->d_inode;
1518 1529
1519 dnew = lookup_one_len(name, ddir, len); 1530 dnew = lookup_one_len(name, ddir, len);
1520 err = PTR_ERR(dnew); 1531 host_err = PTR_ERR(dnew);
1521 if (IS_ERR(dnew)) 1532 if (IS_ERR(dnew))
1522 goto out_nfserr; 1533 goto out_nfserr;
1523 1534
1524 dold = tfhp->fh_dentry; 1535 dold = tfhp->fh_dentry;
1525 dest = dold->d_inode; 1536 dest = dold->d_inode;
1526 1537
1527 err = vfs_link(dold, dirp, dnew); 1538 host_err = vfs_link(dold, dirp, dnew);
1528 if (!err) { 1539 if (!host_err) {
1529 if (EX_ISSYNC(ffhp->fh_export)) { 1540 if (EX_ISSYNC(ffhp->fh_export)) {
1530 err = nfserrno(nfsd_sync_dir(ddir)); 1541 err = nfserrno(nfsd_sync_dir(ddir));
1531 write_inode_now(dest, 1); 1542 write_inode_now(dest, 1);
1532 } 1543 }
1544 err = 0;
1533 } else { 1545 } else {
1534 if (err == -EXDEV && rqstp->rq_vers == 2) 1546 if (host_err == -EXDEV && rqstp->rq_vers == 2)
1535 err = nfserr_acces; 1547 err = nfserr_acces;
1536 else 1548 else
1537 err = nfserrno(err); 1549 err = nfserrno(host_err);
1538 } 1550 }
1539 1551
1540 dput(dnew); 1552 dput(dnew);
@@ -1544,7 +1556,7 @@ out:
1544 return err; 1556 return err;
1545 1557
1546out_nfserr: 1558out_nfserr:
1547 err = nfserrno(err); 1559 err = nfserrno(host_err);
1548 goto out_unlock; 1560 goto out_unlock;
1549} 1561}
1550 1562
@@ -1552,13 +1564,14 @@ out_nfserr:
1552 * Rename a file 1564 * Rename a file
1553 * N.B. After this call _both_ ffhp and tfhp need an fh_put 1565 * N.B. After this call _both_ ffhp and tfhp need an fh_put
1554 */ 1566 */
1555int 1567__be32
1556nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, 1568nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1557 struct svc_fh *tfhp, char *tname, int tlen) 1569 struct svc_fh *tfhp, char *tname, int tlen)
1558{ 1570{
1559 struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap; 1571 struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap;
1560 struct inode *fdir, *tdir; 1572 struct inode *fdir, *tdir;
1561 int err; 1573 __be32 err;
1574 int host_err;
1562 1575
1563 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE); 1576 err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE);
1564 if (err) 1577 if (err)
@@ -1589,22 +1602,22 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1589 fill_pre_wcc(tfhp); 1602 fill_pre_wcc(tfhp);
1590 1603
1591 odentry = lookup_one_len(fname, fdentry, flen); 1604 odentry = lookup_one_len(fname, fdentry, flen);
1592 err = PTR_ERR(odentry); 1605 host_err = PTR_ERR(odentry);
1593 if (IS_ERR(odentry)) 1606 if (IS_ERR(odentry))
1594 goto out_nfserr; 1607 goto out_nfserr;
1595 1608
1596 err = -ENOENT; 1609 host_err = -ENOENT;
1597 if (!odentry->d_inode) 1610 if (!odentry->d_inode)
1598 goto out_dput_old; 1611 goto out_dput_old;
1599 err = -EINVAL; 1612 host_err = -EINVAL;
1600 if (odentry == trap) 1613 if (odentry == trap)
1601 goto out_dput_old; 1614 goto out_dput_old;
1602 1615
1603 ndentry = lookup_one_len(tname, tdentry, tlen); 1616 ndentry = lookup_one_len(tname, tdentry, tlen);
1604 err = PTR_ERR(ndentry); 1617 host_err = PTR_ERR(ndentry);
1605 if (IS_ERR(ndentry)) 1618 if (IS_ERR(ndentry))
1606 goto out_dput_old; 1619 goto out_dput_old;
1607 err = -ENOTEMPTY; 1620 host_err = -ENOTEMPTY;
1608 if (ndentry == trap) 1621 if (ndentry == trap)
1609 goto out_dput_new; 1622 goto out_dput_new;
1610 1623
@@ -1612,14 +1625,14 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1612 if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) && 1625 if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
1613 ((atomic_read(&odentry->d_count) > 1) 1626 ((atomic_read(&odentry->d_count) > 1)
1614 || (atomic_read(&ndentry->d_count) > 1))) { 1627 || (atomic_read(&ndentry->d_count) > 1))) {
1615 err = -EPERM; 1628 host_err = -EPERM;
1616 } else 1629 } else
1617#endif 1630#endif
1618 err = vfs_rename(fdir, odentry, tdir, ndentry); 1631 host_err = vfs_rename(fdir, odentry, tdir, ndentry);
1619 if (!err && EX_ISSYNC(tfhp->fh_export)) { 1632 if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
1620 err = nfsd_sync_dir(tdentry); 1633 host_err = nfsd_sync_dir(tdentry);
1621 if (!err) 1634 if (!host_err)
1622 err = nfsd_sync_dir(fdentry); 1635 host_err = nfsd_sync_dir(fdentry);
1623 } 1636 }
1624 1637
1625 out_dput_new: 1638 out_dput_new:
@@ -1627,8 +1640,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1627 out_dput_old: 1640 out_dput_old:
1628 dput(odentry); 1641 dput(odentry);
1629 out_nfserr: 1642 out_nfserr:
1630 if (err) 1643 err = nfserrno(host_err);
1631 err = nfserrno(err);
1632 1644
1633 /* we cannot reply on fh_unlock on the two filehandles, 1645 /* we cannot reply on fh_unlock on the two filehandles,
1634 * as that would do the wrong thing if the two directories 1646 * as that would do the wrong thing if the two directories
@@ -1647,13 +1659,14 @@ out:
1647 * Unlink a file or directory 1659 * Unlink a file or directory
1648 * N.B. After this call fhp needs an fh_put 1660 * N.B. After this call fhp needs an fh_put
1649 */ 1661 */
1650int 1662__be32
1651nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, 1663nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1652 char *fname, int flen) 1664 char *fname, int flen)
1653{ 1665{
1654 struct dentry *dentry, *rdentry; 1666 struct dentry *dentry, *rdentry;
1655 struct inode *dirp; 1667 struct inode *dirp;
1656 int err; 1668 __be32 err;
1669 int host_err;
1657 1670
1658 err = nfserr_acces; 1671 err = nfserr_acces;
1659 if (!flen || isdotent(fname, flen)) 1672 if (!flen || isdotent(fname, flen))
@@ -1667,7 +1680,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1667 dirp = dentry->d_inode; 1680 dirp = dentry->d_inode;
1668 1681
1669 rdentry = lookup_one_len(fname, dentry, flen); 1682 rdentry = lookup_one_len(fname, dentry, flen);
1670 err = PTR_ERR(rdentry); 1683 host_err = PTR_ERR(rdentry);
1671 if (IS_ERR(rdentry)) 1684 if (IS_ERR(rdentry))
1672 goto out_nfserr; 1685 goto out_nfserr;
1673 1686
@@ -1684,22 +1697,23 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1684#ifdef MSNFS 1697#ifdef MSNFS
1685 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 1698 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
1686 (atomic_read(&rdentry->d_count) > 1)) { 1699 (atomic_read(&rdentry->d_count) > 1)) {
1687 err = -EPERM; 1700 host_err = -EPERM;
1688 } else 1701 } else
1689#endif 1702#endif
1690 err = vfs_unlink(dirp, rdentry); 1703 host_err = vfs_unlink(dirp, rdentry);
1691 } else { /* It's RMDIR */ 1704 } else { /* It's RMDIR */
1692 err = vfs_rmdir(dirp, rdentry); 1705 host_err = vfs_rmdir(dirp, rdentry);
1693 } 1706 }
1694 1707
1695 dput(rdentry); 1708 dput(rdentry);
1696 1709
1697 if (err == 0 && 1710 if (host_err)
1698 EX_ISSYNC(fhp->fh_export)) 1711 goto out_nfserr;
1699 err = nfsd_sync_dir(dentry); 1712 if (EX_ISSYNC(fhp->fh_export))
1713 host_err = nfsd_sync_dir(dentry);
1700 1714
1701out_nfserr: 1715out_nfserr:
1702 err = nfserrno(err); 1716 err = nfserrno(host_err);
1703out: 1717out:
1704 return err; 1718 return err;
1705} 1719}
@@ -1708,11 +1722,12 @@ out:
1708 * Read entries from a directory. 1722 * Read entries from a directory.
1709 * The NFSv3/4 verifier we ignore for now. 1723 * The NFSv3/4 verifier we ignore for now.
1710 */ 1724 */
1711int 1725__be32
1712nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 1726nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1713 struct readdir_cd *cdp, encode_dent_fn func) 1727 struct readdir_cd *cdp, encode_dent_fn func)
1714{ 1728{
1715 int err; 1729 __be32 err;
1730 int host_err;
1716 struct file *file; 1731 struct file *file;
1717 loff_t offset = *offsetp; 1732 loff_t offset = *offsetp;
1718 1733
@@ -1734,10 +1749,10 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1734 1749
1735 do { 1750 do {
1736 cdp->err = nfserr_eof; /* will be cleared on successful read */ 1751 cdp->err = nfserr_eof; /* will be cleared on successful read */
1737 err = vfs_readdir(file, (filldir_t) func, cdp); 1752 host_err = vfs_readdir(file, (filldir_t) func, cdp);
1738 } while (err >=0 && cdp->err == nfs_ok); 1753 } while (host_err >=0 && cdp->err == nfs_ok);
1739 if (err) 1754 if (host_err)
1740 err = nfserrno(err); 1755 err = nfserrno(host_err);
1741 else 1756 else
1742 err = cdp->err; 1757 err = cdp->err;
1743 *offsetp = vfs_llseek(file, 0, 1); 1758 *offsetp = vfs_llseek(file, 0, 1);
@@ -1754,10 +1769,10 @@ out:
1754 * Get file system stats 1769 * Get file system stats
1755 * N.B. After this call fhp needs an fh_put 1770 * N.B. After this call fhp needs an fh_put
1756 */ 1771 */
1757int 1772__be32
1758nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) 1773nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
1759{ 1774{
1760 int err = fh_verify(rqstp, fhp, 0, MAY_NOP); 1775 __be32 err = fh_verify(rqstp, fhp, 0, MAY_NOP);
1761 if (!err && vfs_statfs(fhp->fh_dentry,stat)) 1776 if (!err && vfs_statfs(fhp->fh_dentry,stat))
1762 err = nfserr_io; 1777 err = nfserr_io;
1763 return err; 1778 return err;
@@ -1766,7 +1781,7 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
1766/* 1781/*
1767 * Check for a user's access permissions to this inode. 1782 * Check for a user's access permissions to this inode.
1768 */ 1783 */
1769int 1784__be32
1770nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc) 1785nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
1771{ 1786{
1772 struct inode *inode = dentry->d_inode; 1787 struct inode *inode = dentry->d_inode;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 26a8f8416b79..8df27401d292 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -72,6 +72,7 @@
72#include <linux/audit.h> 72#include <linux/audit.h>
73#include <linux/poll.h> 73#include <linux/poll.h>
74#include <linux/nsproxy.h> 74#include <linux/nsproxy.h>
75#include <linux/oom.h>
75#include "internal.h" 76#include "internal.h"
76 77
77/* NOTE: 78/* NOTE:
@@ -689,7 +690,8 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
689 if (copy_from_user(buffer, buf, count)) 690 if (copy_from_user(buffer, buf, count))
690 return -EFAULT; 691 return -EFAULT;
691 oom_adjust = simple_strtol(buffer, &end, 0); 692 oom_adjust = simple_strtol(buffer, &end, 0);
692 if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE) 693 if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
694 oom_adjust != OOM_DISABLE)
693 return -EINVAL; 695 return -EINVAL;
694 if (*end == '\n') 696 if (*end == '\n')
695 end++; 697 end++;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index ad8cbc49883a..85ce23268302 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -53,6 +53,7 @@
53#include <linux/workqueue.h> 53#include <linux/workqueue.h>
54#include <linux/writeback.h> 54#include <linux/writeback.h>
55#include <linux/blkdev.h> 55#include <linux/blkdev.h>
56#include <linux/backing-dev.h>
56 57
57/* gets a struct reiserfs_journal_list * from a list head */ 58/* gets a struct reiserfs_journal_list * from a list head */
58#define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ 59#define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
@@ -970,7 +971,7 @@ int reiserfs_async_progress_wait(struct super_block *s)
970 DEFINE_WAIT(wait); 971 DEFINE_WAIT(wait);
971 struct reiserfs_journal *j = SB_JOURNAL(s); 972 struct reiserfs_journal *j = SB_JOURNAL(s);
972 if (atomic_read(&j->j_async_throttle)) 973 if (atomic_read(&j->j_async_throttle))
973 blk_congestion_wait(WRITE, HZ / 10); 974 congestion_wait(WRITE, HZ / 10);
974 return 0; 975 return 0;
975} 976}
976 977
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c
index d59737589815..004baf600611 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -21,6 +21,7 @@
21#include <linux/highmem.h> 21#include <linux/highmem.h>
22#include <linux/swap.h> 22#include <linux/swap.h>
23#include <linux/blkdev.h> 23#include <linux/blkdev.h>
24#include <linux/backing-dev.h>
24#include "time.h" 25#include "time.h"
25#include "kmem.h" 26#include "kmem.h"
26 27
@@ -53,7 +54,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
53 printk(KERN_ERR "XFS: possible memory allocation " 54 printk(KERN_ERR "XFS: possible memory allocation "
54 "deadlock in %s (mode:0x%x)\n", 55 "deadlock in %s (mode:0x%x)\n",
55 __FUNCTION__, lflags); 56 __FUNCTION__, lflags);
56 blk_congestion_wait(WRITE, HZ/50); 57 congestion_wait(WRITE, HZ/50);
57 } while (1); 58 } while (1);
58} 59}
59 60
@@ -131,7 +132,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
131 printk(KERN_ERR "XFS: possible memory allocation " 132 printk(KERN_ERR "XFS: possible memory allocation "
132 "deadlock in %s (mode:0x%x)\n", 133 "deadlock in %s (mode:0x%x)\n",
133 __FUNCTION__, lflags); 134 __FUNCTION__, lflags);
134 blk_congestion_wait(WRITE, HZ/50); 135 congestion_wait(WRITE, HZ/50);
135 } while (1); 136 } while (1);
136} 137}
137 138
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 9bbadafdcb00..db5f5a3608ca 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -30,6 +30,7 @@
30#include <linux/hash.h> 30#include <linux/hash.h>
31#include <linux/kthread.h> 31#include <linux/kthread.h>
32#include <linux/migrate.h> 32#include <linux/migrate.h>
33#include <linux/backing-dev.h>
33#include "xfs_linux.h" 34#include "xfs_linux.h"
34 35
35STATIC kmem_zone_t *xfs_buf_zone; 36STATIC kmem_zone_t *xfs_buf_zone;
@@ -395,7 +396,7 @@ _xfs_buf_lookup_pages(
395 396
396 XFS_STATS_INC(xb_page_retries); 397 XFS_STATS_INC(xb_page_retries);
397 xfsbufd_wakeup(0, gfp_mask); 398 xfsbufd_wakeup(0, gfp_mask);
398 blk_congestion_wait(WRITE, HZ/50); 399 congestion_wait(WRITE, HZ/50);
399 goto retry; 400 goto retry;
400 } 401 }
401 402
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 1d9573cf4a0b..c92ae0f166ff 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -37,7 +37,10 @@
37#endif 37#endif
38 38
39#ifndef HAVE_ARCH_WARN_ON 39#ifndef HAVE_ARCH_WARN_ON
40#define WARN_ON(condition) unlikely((condition)) 40#define WARN_ON(condition) ({ \
41 typeof(condition) __ret_warn_on = (condition); \
42 unlikely(__ret_warn_on); \
43})
41#endif 44#endif
42#endif 45#endif
43 46
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index 83a3dd15a6ed..aaf6ef40ee2f 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -8,11 +8,6 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10 10
11#ifdef __KERNEL__
12#include <asm/mbus.h>
13#include <asm/uaccess.h>
14#endif
15
16/* 11/*
17 * Sparc section types 12 * Sparc section types
18 */ 13 */
@@ -77,6 +72,23 @@ typedef unsigned long elf_greg_t;
77#define ELF_NGREG 38 72#define ELF_NGREG 38
78typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 73typedef elf_greg_t elf_gregset_t[ELF_NGREG];
79 74
75typedef struct {
76 union {
77 unsigned long pr_regs[32];
78 double pr_dregs[16];
79 } pr_fr;
80 unsigned long __unused;
81 unsigned long pr_fsr;
82 unsigned char pr_qcnt;
83 unsigned char pr_q_entrysize;
84 unsigned char pr_en;
85 unsigned int pr_q[64];
86} elf_fpregset_t;
87
88#ifdef __KERNEL__
89#include <asm/mbus.h>
90#include <asm/uaccess.h>
91
80/* Format is: 92/* Format is:
81 * G0 --> G7 93 * G0 --> G7
82 * O0 --> O7 94 * O0 --> O7
@@ -99,20 +111,7 @@ do { unsigned long *dest = &(__elf_regs[0]); \
99 dest[34] = src->npc; \ 111 dest[34] = src->npc; \
100 dest[35] = src->y; \ 112 dest[35] = src->y; \
101 dest[36] = dest[37] = 0; /* XXX */ \ 113 dest[36] = dest[37] = 0; /* XXX */ \
102} while(0); /* Janitors: Don't touch this colon. */ 114} while(0); /* Janitors: Don't touch this semicolon. */
103
104typedef struct {
105 union {
106 unsigned long pr_regs[32];
107 double pr_dregs[16];
108 } pr_fr;
109 unsigned long __unused;
110 unsigned long pr_fsr;
111 unsigned char pr_qcnt;
112 unsigned char pr_q_entrysize;
113 unsigned char pr_en;
114 unsigned int pr_q[64];
115} elf_fpregset_t;
116 115
117#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ 116#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
118 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; }) 117 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
@@ -165,8 +164,8 @@ typedef struct {
165 164
166#define ELF_PLATFORM (NULL) 165#define ELF_PLATFORM (NULL)
167 166
168#ifdef __KERNEL__
169#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 167#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
170#endif 168
169#endif /* __KERNEL__ */
171 170
172#endif /* !(__ASMSPARC_ELF_H) */ 171#endif /* !(__ASMSPARC_ELF_H) */
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h
index 172cd6ffacc4..4269d8a37b4f 100644
--- a/include/asm-um/archparam-ppc.h
+++ b/include/asm-um/archparam-ppc.h
@@ -1,15 +1,6 @@
1#ifndef __UM_ARCHPARAM_PPC_H 1#ifndef __UM_ARCHPARAM_PPC_H
2#define __UM_ARCHPARAM_PPC_H 2#define __UM_ARCHPARAM_PPC_H
3 3
4/********* Bits for asm-um/hw_irq.h **********/
5
6struct hw_interrupt_type;
7
8/********* Bits for asm-um/hardirq.h **********/
9
10#define irq_enter(cpu, irq) hardirq_enter(cpu)
11#define irq_exit(cpu, irq) hardirq_exit(cpu)
12
13/********* Bits for asm-um/string.h **********/ 4/********* Bits for asm-um/string.h **********/
14 5
15#define __HAVE_ARCH_STRRCHR 6#define __HAVE_ARCH_STRRCHR
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5114ff18101d..a1155a2beb32 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -120,6 +120,7 @@ header-y += netrom.h
120header-y += nfs2.h 120header-y += nfs2.h
121header-y += nfs4_mount.h 121header-y += nfs4_mount.h
122header-y += nfs_mount.h 122header-y += nfs_mount.h
123header-y += oom.h
123header-y += param.h 124header-y += param.h
124header-y += pci_ids.h 125header-y += pci_ids.h
125header-y += pci_regs.h 126header-y += pci_regs.h
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index f7a1390d67f5..7011d6255593 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -10,6 +10,8 @@
10 10
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12 12
13struct page;
14
13/* 15/*
14 * Bits in backing_dev_info.state 16 * Bits in backing_dev_info.state
15 */ 17 */
@@ -88,6 +90,11 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
88 (1 << BDI_write_congested)); 90 (1 << BDI_write_congested));
89} 91}
90 92
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout);
96void congestion_end(int rw);
97
91#define bdi_cap_writeback_dirty(bdi) \ 98#define bdi_cap_writeback_dirty(bdi) \
92 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) 99 (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
93 100
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d370d2cfe138..7bfcde2d5578 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -651,6 +651,26 @@ extern void blk_recount_segments(request_queue_t *, struct bio *);
651extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *); 651extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
652extern int sg_scsi_ioctl(struct file *, struct request_queue *, 652extern int sg_scsi_ioctl(struct file *, struct request_queue *,
653 struct gendisk *, struct scsi_ioctl_command __user *); 653 struct gendisk *, struct scsi_ioctl_command __user *);
654
655/*
656 * A queue has just exitted congestion. Note this in the global counter of
657 * congested queues, and wake up anyone who was waiting for requests to be
658 * put back.
659 */
660static inline void blk_clear_queue_congested(request_queue_t *q, int rw)
661{
662 clear_bdi_congested(&q->backing_dev_info, rw);
663}
664
665/*
666 * A queue has just entered congestion. Flag that in the queue's VM-visible
667 * state flags and increment the global gounter of congested queues.
668 */
669static inline void blk_set_queue_congested(request_queue_t *q, int rw)
670{
671 set_bdi_congested(&q->backing_dev_info, rw);
672}
673
654extern void blk_start_queue(request_queue_t *q); 674extern void blk_start_queue(request_queue_t *q);
655extern void blk_stop_queue(request_queue_t *q); 675extern void blk_stop_queue(request_queue_t *q);
656extern void blk_sync_queue(struct request_queue *q); 676extern void blk_sync_queue(struct request_queue *q);
@@ -765,10 +785,8 @@ extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
765extern void blk_queue_free_tags(request_queue_t *); 785extern void blk_queue_free_tags(request_queue_t *);
766extern int blk_queue_resize_tags(request_queue_t *, int); 786extern int blk_queue_resize_tags(request_queue_t *, int);
767extern void blk_queue_invalidate_tags(request_queue_t *); 787extern void blk_queue_invalidate_tags(request_queue_t *);
768extern long blk_congestion_wait(int rw, long timeout);
769extern struct blk_queue_tag *blk_init_tags(int); 788extern struct blk_queue_tag *blk_init_tags(int);
770extern void blk_free_tags(struct blk_queue_tag *); 789extern void blk_free_tags(struct blk_queue_tag *);
771extern void blk_congestion_end(int rw);
772 790
773static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, 791static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
774 int tag) 792 int tag)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 775f5a7da493..52fc4052a0ae 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -322,6 +322,9 @@ extern struct irq_chip no_irq_chip;
322extern struct irq_chip dummy_irq_chip; 322extern struct irq_chip dummy_irq_chip;
323 323
324extern void 324extern void
325set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
326 irq_flow_handler_t handle);
327extern void
325set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, 328set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
326 irq_flow_handler_t handle, const char *name); 329 irq_flow_handler_t handle, const char *name);
327 330
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 2909619c0295..862d9730a60d 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -154,7 +154,7 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 154struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
155void nlmclnt_finish_block(struct nlm_wait *block); 155void nlmclnt_finish_block(struct nlm_wait *block);
156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 156int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
157u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 157__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
158void nlmclnt_recovery(struct nlm_host *); 158void nlmclnt_recovery(struct nlm_host *);
159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 159int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
160void nlmclnt_next_cookie(struct nlm_cookie *); 160void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -184,12 +184,12 @@ typedef int (*nlm_host_match_fn_t)(struct nlm_host *cur, struct nlm_host *ref)
184/* 184/*
185 * Server-side lock handling 185 * Server-side lock handling
186 */ 186 */
187u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 187__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
188 struct nlm_lock *, int, struct nlm_cookie *); 188 struct nlm_lock *, int, struct nlm_cookie *);
189u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 189__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
190u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, 190__be32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
191 struct nlm_lock *); 191 struct nlm_lock *);
192u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 192__be32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
193unsigned long nlmsvc_retry_blocked(void); 193unsigned long nlmsvc_retry_blocked(void);
194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 194void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
195 nlm_host_match_fn_t match); 195 nlm_host_match_fn_t match);
@@ -198,7 +198,7 @@ void nlmsvc_grant_reply(struct nlm_cookie *, u32);
198/* 198/*
199 * File handling for the server personality 199 * File handling for the server personality
200 */ 200 */
201u32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, 201__be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
202 struct nfs_fh *); 202 struct nfs_fh *);
203void nlm_release_file(struct nlm_file *); 203void nlm_release_file(struct nlm_file *);
204void nlmsvc_mark_resources(void); 204void nlmsvc_mark_resources(void);
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index cd7816e74c05..630c5bf69b07 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -21,9 +21,9 @@ struct nlm_share {
21 u32 s_mode; /* deny mode */ 21 u32 s_mode; /* deny mode */
22}; 22};
23 23
24u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *, 24__be32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26__be32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *,
29 nlm_host_match_fn_t); 29 nlm_host_match_fn_t);
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 66fdae3b490c..29e7d9fc9dad 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -90,19 +90,19 @@ struct nlm_reboot {
90 */ 90 */
91#define NLMSVC_XDRSIZE sizeof(struct nlm_args) 91#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
92 92
93int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 93int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
94int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 94int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
95int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 95int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
96int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 96int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
97int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 97int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
98int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 98int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
99int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 99int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
100int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *); 100int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
101int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *); 101int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
102int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 102int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
103int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 103int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
104int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 104int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
105int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 105int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
106/* 106/*
107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 107int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 108int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 3cc1ae25009b..dd12b4c9e613 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -23,19 +23,19 @@
23 23
24 24
25 25
26int nlm4svc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); 26int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
27int nlm4svc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); 27int nlm4svc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
28int nlm4svc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); 28int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
29int nlm4svc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); 29int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
30int nlm4svc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); 30int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
31int nlm4svc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); 31int nlm4svc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
32int nlm4svc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); 32int nlm4svc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
33int nlm4svc_encode_void(struct svc_rqst *, u32 *, void *); 33int nlm4svc_encode_void(struct svc_rqst *, __be32 *, void *);
34int nlm4svc_decode_void(struct svc_rqst *, u32 *, void *); 34int nlm4svc_decode_void(struct svc_rqst *, __be32 *, void *);
35int nlm4svc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); 35int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
36int nlm4svc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); 36int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
37int nlm4svc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); 37int nlm4svc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
38int nlm4svc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); 38int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
39/* 39/*
40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5a6068ff5556..d538de901965 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1115,9 +1115,6 @@ int in_gate_area_no_task(unsigned long addr);
1115#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1115#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1116#endif /* __HAVE_ARCH_GATE_AREA */ 1116#endif /* __HAVE_ARCH_GATE_AREA */
1117 1117
1118/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
1119#define OOM_DISABLE -17
1120
1121int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1118int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1122 void __user *, size_t *, loff_t *); 1119 void __user *, size_t *, loff_t *);
1123unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1120unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 76ff54846ada..45228c1a1195 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -157,7 +157,7 @@ struct nfs_inode {
157 * This is the cookie verifier used for NFSv3 readdir 157 * This is the cookie verifier used for NFSv3 readdir
158 * operations 158 * operations
159 */ 159 */
160 __u32 cookieverf[2]; 160 __be32 cookieverf[2];
161 161
162 /* 162 /*
163 * This is the list of dirty unwritten pages. 163 * This is the list of dirty unwritten pages.
@@ -290,6 +290,7 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
290 * linux/fs/nfs/inode.c 290 * linux/fs/nfs/inode.c
291 */ 291 */
292extern int nfs_sync_mapping(struct address_space *mapping); 292extern int nfs_sync_mapping(struct address_space *mapping);
293extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
293extern void nfs_zap_caches(struct inode *); 294extern void nfs_zap_caches(struct inode *);
294extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 295extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
295 struct nfs_fattr *); 296 struct nfs_fattr *);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index dc5397d9d23c..768c1ad5ff6f 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -266,7 +266,7 @@ struct nfs_writeargs {
266 266
267struct nfs_writeverf { 267struct nfs_writeverf {
268 enum nfs3_stable_how committed; 268 enum nfs3_stable_how committed;
269 __u32 verifier[2]; 269 __be32 verifier[2];
270}; 270};
271 271
272struct nfs_writeres { 272struct nfs_writeres {
@@ -420,7 +420,7 @@ struct nfs3_createargs {
420 unsigned int len; 420 unsigned int len;
421 struct iattr * sattr; 421 struct iattr * sattr;
422 enum nfs3_createmode createmode; 422 enum nfs3_createmode createmode;
423 __u32 verifier[2]; 423 __be32 verifier[2];
424}; 424};
425 425
426struct nfs3_mkdirargs { 426struct nfs3_mkdirargs {
@@ -467,7 +467,7 @@ struct nfs3_linkargs {
467struct nfs3_readdirargs { 467struct nfs3_readdirargs {
468 struct nfs_fh * fh; 468 struct nfs_fh * fh;
469 __u64 cookie; 469 __u64 cookie;
470 __u32 verf[2]; 470 __be32 verf[2];
471 int plus; 471 int plus;
472 unsigned int count; 472 unsigned int count;
473 struct page ** pages; 473 struct page ** pages;
@@ -503,7 +503,7 @@ struct nfs3_linkres {
503 503
504struct nfs3_readdirres { 504struct nfs3_readdirres {
505 struct nfs_fattr * dir_attr; 505 struct nfs_fattr * dir_attr;
506 __u32 * verf; 506 __be32 * verf;
507 int plus; 507 int plus;
508}; 508};
509 509
@@ -811,7 +811,7 @@ struct nfs_rpc_ops {
811 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 811 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
812 struct nfs_pathconf *); 812 struct nfs_pathconf *);
813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 813 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
814 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 814 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
815 void (*read_setup) (struct nfs_read_data *); 815 void (*read_setup) (struct nfs_read_data *);
816 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 816 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
817 void (*write_setup) (struct nfs_write_data *, int how); 817 void (*write_setup) (struct nfs_write_data *, int how);
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index c3a3557c2a5b..007480cd6a60 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -26,14 +26,14 @@ struct svc_cacherep {
26 c_type, /* status, buffer */ 26 c_type, /* status, buffer */
27 c_secure : 1; /* req came from port < 1024 */ 27 c_secure : 1; /* req came from port < 1024 */
28 struct sockaddr_in c_addr; 28 struct sockaddr_in c_addr;
29 u32 c_xid; 29 __be32 c_xid;
30 u32 c_prot; 30 u32 c_prot;
31 u32 c_proc; 31 u32 c_proc;
32 u32 c_vers; 32 u32 c_vers;
33 unsigned long c_timestamp; 33 unsigned long c_timestamp;
34 union { 34 union {
35 struct kvec u_vec; 35 struct kvec u_vec;
36 u32 u_status; 36 __be32 u_status;
37 } c_u; 37 } c_u;
38}; 38};
39 39
@@ -75,7 +75,7 @@ enum {
75void nfsd_cache_init(void); 75void nfsd_cache_init(void);
76void nfsd_cache_shutdown(void); 76void nfsd_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, u32 *); 78void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 79
80#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
81#endif /* NFSCACHE_H */ 81#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 6e78ea969f49..045e38cdbe64 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -117,8 +117,8 @@ struct svc_export * exp_parent(struct auth_domain *clp,
117 struct cache_req *reqp); 117 struct cache_req *reqp);
118int exp_rootfh(struct auth_domain *, 118int exp_rootfh(struct auth_domain *,
119 char *path, struct knfsd_fh *, int maxsize); 119 char *path, struct knfsd_fh *, int maxsize);
120int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 120__be32 exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
121int nfserrno(int errno); 121__be32 nfserrno(int errno);
122 122
123extern struct cache_detail svc_export_cache; 123extern struct cache_detail svc_export_cache;
124 124
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index d0d4aae7085f..eb231143d579 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -50,7 +50,7 @@
50 * Callback function for readdir 50 * Callback function for readdir
51 */ 51 */
52struct readdir_cd { 52struct readdir_cd {
53 int err; /* 0, nfserr, or nfserr_eof */ 53 __be32 err; /* 0, nfserr, or nfserr_eof */
54}; 54};
55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, 55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
56 int, loff_t, ino_t, unsigned int); 56 int, loff_t, ino_t, unsigned int);
@@ -64,7 +64,7 @@ extern struct svc_serv *nfsd_serv;
64 * Function prototypes. 64 * Function prototypes.
65 */ 65 */
66int nfsd_svc(unsigned short port, int nrservs); 66int nfsd_svc(unsigned short port, int nrservs);
67int nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp); 67int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
68 68
69/* nfsd/vfs.c */ 69/* nfsd/vfs.c */
70int fh_lock_parent(struct svc_fh *, struct dentry *); 70int fh_lock_parent(struct svc_fh *, struct dentry *);
@@ -72,57 +72,57 @@ int nfsd_racache_init(int);
72void nfsd_racache_shutdown(void); 72void nfsd_racache_shutdown(void);
73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, 73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
74 struct svc_export **expp); 74 struct svc_export **expp);
75int nfsd_lookup(struct svc_rqst *, struct svc_fh *, 75__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
76 const char *, int, struct svc_fh *); 76 const char *, int, struct svc_fh *);
77int nfsd_setattr(struct svc_rqst *, struct svc_fh *, 77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t); 78 struct iattr *, int, time_t);
79#ifdef CONFIG_NFSD_V4 79#ifdef CONFIG_NFSD_V4
80int nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, 80__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
81 struct nfs4_acl *); 81 struct nfs4_acl *);
82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); 82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
83#endif /* CONFIG_NFSD_V4 */ 83#endif /* CONFIG_NFSD_V4 */
84int nfsd_create(struct svc_rqst *, struct svc_fh *, 84__be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
85 char *name, int len, struct iattr *attrs, 85 char *name, int len, struct iattr *attrs,
86 int type, dev_t rdev, struct svc_fh *res); 86 int type, dev_t rdev, struct svc_fh *res);
87#ifdef CONFIG_NFSD_V3 87#ifdef CONFIG_NFSD_V3
88int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); 88__be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, 89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs, 90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode, 91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp); 92 u32 *verifier, int *truncp);
93int nfsd_commit(struct svc_rqst *, struct svc_fh *, 93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long); 94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */ 95#endif /* CONFIG_NFSD_V3 */
96int nfsd_open(struct svc_rqst *, struct svc_fh *, int, 96__be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int,
97 int, struct file **); 97 int, struct file **);
98void nfsd_close(struct file *); 98void nfsd_close(struct file *);
99int nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 99__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
100 loff_t, struct kvec *, int, unsigned long *); 100 loff_t, struct kvec *, int, unsigned long *);
101int nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 101__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
102 loff_t, struct kvec *,int, unsigned long, int *); 102 loff_t, struct kvec *,int, unsigned long, int *);
103int nfsd_readlink(struct svc_rqst *, struct svc_fh *, 103__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
104 char *, int *); 104 char *, int *);
105int nfsd_symlink(struct svc_rqst *, struct svc_fh *, 105__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
106 char *name, int len, char *path, int plen, 106 char *name, int len, char *path, int plen,
107 struct svc_fh *res, struct iattr *); 107 struct svc_fh *res, struct iattr *);
108int nfsd_link(struct svc_rqst *, struct svc_fh *, 108__be32 nfsd_link(struct svc_rqst *, struct svc_fh *,
109 char *, int, struct svc_fh *); 109 char *, int, struct svc_fh *);
110int nfsd_rename(struct svc_rqst *, 110__be32 nfsd_rename(struct svc_rqst *,
111 struct svc_fh *, char *, int, 111 struct svc_fh *, char *, int,
112 struct svc_fh *, char *, int); 112 struct svc_fh *, char *, int);
113int nfsd_remove(struct svc_rqst *, 113__be32 nfsd_remove(struct svc_rqst *,
114 struct svc_fh *, char *, int); 114 struct svc_fh *, char *, int);
115int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, 115__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
116 char *name, int len); 116 char *name, int len);
117int nfsd_truncate(struct svc_rqst *, struct svc_fh *, 117int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
118 unsigned long size); 118 unsigned long size);
119int nfsd_readdir(struct svc_rqst *, struct svc_fh *, 119__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
120 loff_t *, struct readdir_cd *, encode_dent_fn); 120 loff_t *, struct readdir_cd *, encode_dent_fn);
121int nfsd_statfs(struct svc_rqst *, struct svc_fh *, 121__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
122 struct kstatfs *); 122 struct kstatfs *);
123 123
124int nfsd_notify_change(struct inode *, struct iattr *); 124int nfsd_notify_change(struct inode *, struct iattr *);
125int nfsd_permission(struct svc_export *, struct dentry *, int); 125__be32 nfsd_permission(struct svc_export *, struct dentry *, int);
126int nfsd_sync_dir(struct dentry *dp); 126int nfsd_sync_dir(struct dentry *dp);
127 127
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -238,6 +238,7 @@ void nfsd_lockd_shutdown(void);
238#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 238#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 239#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
240#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 240#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
241#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME)
241 242
242/* error codes for internal use */ 243/* error codes for internal use */
243/* if a request fails due to kmalloc failure, it gets dropped. 244/* if a request fails due to kmalloc failure, it gets dropped.
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 069257ea99a0..f3b51d62ec7d 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -157,7 +157,7 @@ typedef struct svc_fh {
157 __u64 fh_post_size; /* i_size */ 157 __u64 fh_post_size; /* i_size */
158 unsigned long fh_post_blocks; /* i_blocks */ 158 unsigned long fh_post_blocks; /* i_blocks */
159 unsigned long fh_post_blksize;/* i_blksize */ 159 unsigned long fh_post_blksize;/* i_blksize */
160 __u32 fh_post_rdev[2];/* i_rdev */ 160 __be32 fh_post_rdev[2];/* i_rdev */
161 struct timespec fh_post_atime; /* i_atime */ 161 struct timespec fh_post_atime; /* i_atime */
162 struct timespec fh_post_mtime; /* i_mtime */ 162 struct timespec fh_post_mtime; /* i_mtime */
163 struct timespec fh_post_ctime; /* i_ctime */ 163 struct timespec fh_post_ctime; /* i_ctime */
@@ -209,9 +209,9 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
209/* 209/*
210 * Function prototypes 210 * Function prototypes
211 */ 211 */
212u32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); 212__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
213int fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); 213__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
214int fh_update(struct svc_fh *); 214__be32 fh_update(struct svc_fh *);
215void fh_put(struct svc_fh *); 215void fh_put(struct svc_fh *);
216 216
217static __inline__ struct svc_fh * 217static __inline__ struct svc_fh *
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 8bf23cf8b603..c3673f487e84 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -125,7 +125,7 @@ struct nfs4_client {
125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
126 nfs4_verifier cl_verifier; /* generated by client */ 126 nfs4_verifier cl_verifier; /* generated by client */
127 time_t cl_time; /* time of last lease renewal */ 127 time_t cl_time; /* time of last lease renewal */
128 u32 cl_addr; /* client ipaddress */ 128 __be32 cl_addr; /* client ipaddress */
129 struct svc_cred cl_cred; /* setclientid principal */ 129 struct svc_cred cl_cred; /* setclientid principal */
130 clientid_t cl_clientid; /* generated by server */ 130 clientid_t cl_clientid; /* generated by server */
131 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
@@ -164,7 +164,7 @@ update_stateid(stateid_t *stateid)
164 * is cached. 164 * is cached.
165 */ 165 */
166struct nfs4_replay { 166struct nfs4_replay {
167 u32 rp_status; 167 __be32 rp_status;
168 unsigned int rp_buflen; 168 unsigned int rp_buflen;
169 char *rp_buf; 169 char *rp_buf;
170 unsigned intrp_allocated; 170 unsigned intrp_allocated;
@@ -273,19 +273,19 @@ struct nfs4_stateid {
273 ((err) != nfserr_stale_stateid) && \ 273 ((err) != nfserr_stale_stateid) && \
274 ((err) != nfserr_bad_stateid)) 274 ((err) != nfserr_bad_stateid))
275 275
276extern int nfsd4_renew(clientid_t *clid); 276extern __be32 nfsd4_renew(clientid_t *clid);
277extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 277extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
278 stateid_t *stateid, int flags, struct file **filp); 278 stateid_t *stateid, int flags, struct file **filp);
279extern void nfs4_lock_state(void); 279extern void nfs4_lock_state(void);
280extern void nfs4_unlock_state(void); 280extern void nfs4_unlock_state(void);
281extern int nfs4_in_grace(void); 281extern int nfs4_in_grace(void);
282extern int nfs4_check_open_reclaim(clientid_t *clid); 282extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
283extern void put_nfs4_client(struct nfs4_client *clp); 283extern void put_nfs4_client(struct nfs4_client *clp);
284extern void nfs4_free_stateowner(struct kref *kref); 284extern void nfs4_free_stateowner(struct kref *kref);
285extern void nfsd4_probe_callback(struct nfs4_client *clp); 285extern void nfsd4_probe_callback(struct nfs4_client *clp);
286extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 286extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
287extern void nfs4_put_delegation(struct nfs4_delegation *dp); 287extern void nfs4_put_delegation(struct nfs4_delegation *dp);
288extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); 288extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
289extern void nfsd4_init_recdir(char *recdir_name); 289extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void); 290extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void); 291extern void nfsd4_shutdown_recdir(void);
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 0e53de87d886..877192d3ae79 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -81,7 +81,7 @@ struct nfsd_readdirargs {
81 struct svc_fh fh; 81 struct svc_fh fh;
82 __u32 cookie; 82 __u32 cookie;
83 __u32 count; 83 __u32 count;
84 u32 * buffer; 84 __be32 * buffer;
85}; 85};
86 86
87struct nfsd_attrstat { 87struct nfsd_attrstat {
@@ -108,9 +108,9 @@ struct nfsd_readdirres {
108 int count; 108 int count;
109 109
110 struct readdir_cd common; 110 struct readdir_cd common;
111 u32 * buffer; 111 __be32 * buffer;
112 int buflen; 112 int buflen;
113 u32 * offset; 113 __be32 * offset;
114}; 114};
115 115
116struct nfsd_statfsres { 116struct nfsd_statfsres {
@@ -135,43 +135,43 @@ union nfsd_xdrstore {
135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) 135#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
136 136
137 137
138int nfssvc_decode_void(struct svc_rqst *, u32 *, void *); 138int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
139int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 139int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
140int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *, 140int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
141 struct nfsd_sattrargs *); 141 struct nfsd_sattrargs *);
142int nfssvc_decode_diropargs(struct svc_rqst *, u32 *, 142int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
143 struct nfsd_diropargs *); 143 struct nfsd_diropargs *);
144int nfssvc_decode_readargs(struct svc_rqst *, u32 *, 144int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
145 struct nfsd_readargs *); 145 struct nfsd_readargs *);
146int nfssvc_decode_writeargs(struct svc_rqst *, u32 *, 146int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
147 struct nfsd_writeargs *); 147 struct nfsd_writeargs *);
148int nfssvc_decode_createargs(struct svc_rqst *, u32 *, 148int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
149 struct nfsd_createargs *); 149 struct nfsd_createargs *);
150int nfssvc_decode_renameargs(struct svc_rqst *, u32 *, 150int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
151 struct nfsd_renameargs *); 151 struct nfsd_renameargs *);
152int nfssvc_decode_readlinkargs(struct svc_rqst *, u32 *, 152int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
153 struct nfsd_readlinkargs *); 153 struct nfsd_readlinkargs *);
154int nfssvc_decode_linkargs(struct svc_rqst *, u32 *, 154int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
155 struct nfsd_linkargs *); 155 struct nfsd_linkargs *);
156int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *, 156int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
157 struct nfsd_symlinkargs *); 157 struct nfsd_symlinkargs *);
158int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *, 158int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
159 struct nfsd_readdirargs *); 159 struct nfsd_readdirargs *);
160int nfssvc_encode_void(struct svc_rqst *, u32 *, void *); 160int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
161int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *); 161int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
162int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *); 162int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
163int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *); 163int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
164int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *); 164int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
165int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *); 165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
166int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); 166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
167 167
168int nfssvc_encode_entry(struct readdir_cd *, const char *name, 168int nfssvc_encode_entry(struct readdir_cd *, const char *name,
169 int namlen, loff_t offset, ino_t ino, unsigned int); 169 int namlen, loff_t offset, ino_t ino, unsigned int);
170 170
171int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
172 172
173/* Helper functions for NFSv2 ACL code */ 173/* Helper functions for NFSv2 ACL code */
174u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp); 174__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
175u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp); 175__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
176 176
177#endif /* LINUX_NFSD_H */ 177#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 474d882dc2f3..79963867b0d7 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -51,7 +51,7 @@ struct nfsd3_createargs {
51 int len; 51 int len;
52 int createmode; 52 int createmode;
53 struct iattr attrs; 53 struct iattr attrs;
54 __u32 * verf; 54 __be32 * verf;
55}; 55};
56 56
57struct nfsd3_mknodargs { 57struct nfsd3_mknodargs {
@@ -98,8 +98,8 @@ struct nfsd3_readdirargs {
98 __u64 cookie; 98 __u64 cookie;
99 __u32 dircount; 99 __u32 dircount;
100 __u32 count; 100 __u32 count;
101 __u32 * verf; 101 __be32 * verf;
102 u32 * buffer; 102 __be32 * buffer;
103}; 103};
104 104
105struct nfsd3_commitargs { 105struct nfsd3_commitargs {
@@ -122,79 +122,79 @@ struct nfsd3_setaclargs {
122}; 122};
123 123
124struct nfsd3_attrstat { 124struct nfsd3_attrstat {
125 __u32 status; 125 __be32 status;
126 struct svc_fh fh; 126 struct svc_fh fh;
127 struct kstat stat; 127 struct kstat stat;
128}; 128};
129 129
130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
131struct nfsd3_diropres { 131struct nfsd3_diropres {
132 __u32 status; 132 __be32 status;
133 struct svc_fh dirfh; 133 struct svc_fh dirfh;
134 struct svc_fh fh; 134 struct svc_fh fh;
135}; 135};
136 136
137struct nfsd3_accessres { 137struct nfsd3_accessres {
138 __u32 status; 138 __be32 status;
139 struct svc_fh fh; 139 struct svc_fh fh;
140 __u32 access; 140 __u32 access;
141}; 141};
142 142
143struct nfsd3_readlinkres { 143struct nfsd3_readlinkres {
144 __u32 status; 144 __be32 status;
145 struct svc_fh fh; 145 struct svc_fh fh;
146 __u32 len; 146 __u32 len;
147}; 147};
148 148
149struct nfsd3_readres { 149struct nfsd3_readres {
150 __u32 status; 150 __be32 status;
151 struct svc_fh fh; 151 struct svc_fh fh;
152 unsigned long count; 152 unsigned long count;
153 int eof; 153 int eof;
154}; 154};
155 155
156struct nfsd3_writeres { 156struct nfsd3_writeres {
157 __u32 status; 157 __be32 status;
158 struct svc_fh fh; 158 struct svc_fh fh;
159 unsigned long count; 159 unsigned long count;
160 int committed; 160 int committed;
161}; 161};
162 162
163struct nfsd3_renameres { 163struct nfsd3_renameres {
164 __u32 status; 164 __be32 status;
165 struct svc_fh ffh; 165 struct svc_fh ffh;
166 struct svc_fh tfh; 166 struct svc_fh tfh;
167}; 167};
168 168
169struct nfsd3_linkres { 169struct nfsd3_linkres {
170 __u32 status; 170 __be32 status;
171 struct svc_fh tfh; 171 struct svc_fh tfh;
172 struct svc_fh fh; 172 struct svc_fh fh;
173}; 173};
174 174
175struct nfsd3_readdirres { 175struct nfsd3_readdirres {
176 __u32 status; 176 __be32 status;
177 struct svc_fh fh; 177 struct svc_fh fh;
178 int count; 178 int count;
179 __u32 verf[2]; 179 __be32 verf[2];
180 180
181 struct readdir_cd common; 181 struct readdir_cd common;
182 u32 * buffer; 182 __be32 * buffer;
183 int buflen; 183 int buflen;
184 u32 * offset; 184 __be32 * offset;
185 u32 * offset1; 185 __be32 * offset1;
186 struct svc_rqst * rqstp; 186 struct svc_rqst * rqstp;
187 187
188}; 188};
189 189
190struct nfsd3_fsstatres { 190struct nfsd3_fsstatres {
191 __u32 status; 191 __be32 status;
192 struct kstatfs stats; 192 struct kstatfs stats;
193 __u32 invarsec; 193 __u32 invarsec;
194}; 194};
195 195
196struct nfsd3_fsinfores { 196struct nfsd3_fsinfores {
197 __u32 status; 197 __be32 status;
198 __u32 f_rtmax; 198 __u32 f_rtmax;
199 __u32 f_rtpref; 199 __u32 f_rtpref;
200 __u32 f_rtmult; 200 __u32 f_rtmult;
@@ -207,7 +207,7 @@ struct nfsd3_fsinfores {
207}; 207};
208 208
209struct nfsd3_pathconfres { 209struct nfsd3_pathconfres {
210 __u32 status; 210 __be32 status;
211 __u32 p_link_max; 211 __u32 p_link_max;
212 __u32 p_name_max; 212 __u32 p_name_max;
213 __u32 p_no_trunc; 213 __u32 p_no_trunc;
@@ -217,12 +217,12 @@ struct nfsd3_pathconfres {
217}; 217};
218 218
219struct nfsd3_commitres { 219struct nfsd3_commitres {
220 __u32 status; 220 __be32 status;
221 struct svc_fh fh; 221 struct svc_fh fh;
222}; 222};
223 223
224struct nfsd3_getaclres { 224struct nfsd3_getaclres {
225 __u32 status; 225 __be32 status;
226 struct svc_fh fh; 226 struct svc_fh fh;
227 int mask; 227 int mask;
228 struct posix_acl *acl_access; 228 struct posix_acl *acl_access;
@@ -266,70 +266,70 @@ union nfsd3_xdrstore {
266 266
267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
268 268
269int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); 269int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
270int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *, 270int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
271 struct nfsd3_sattrargs *); 271 struct nfsd3_sattrargs *);
272int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *, 272int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
273 struct nfsd3_diropargs *); 273 struct nfsd3_diropargs *);
274int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *, 274int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
275 struct nfsd3_accessargs *); 275 struct nfsd3_accessargs *);
276int nfs3svc_decode_readargs(struct svc_rqst *, u32 *, 276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
277 struct nfsd3_readargs *); 277 struct nfsd3_readargs *);
278int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *, 278int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
279 struct nfsd3_writeargs *); 279 struct nfsd3_writeargs *);
280int nfs3svc_decode_createargs(struct svc_rqst *, u32 *, 280int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
281 struct nfsd3_createargs *); 281 struct nfsd3_createargs *);
282int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *, 282int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
283 struct nfsd3_createargs *); 283 struct nfsd3_createargs *);
284int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *, 284int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
285 struct nfsd3_mknodargs *); 285 struct nfsd3_mknodargs *);
286int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *, 286int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
287 struct nfsd3_renameargs *); 287 struct nfsd3_renameargs *);
288int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *, 288int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
289 struct nfsd3_readlinkargs *); 289 struct nfsd3_readlinkargs *);
290int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *, 290int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
291 struct nfsd3_linkargs *); 291 struct nfsd3_linkargs *);
292int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *, 292int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
293 struct nfsd3_symlinkargs *); 293 struct nfsd3_symlinkargs *);
294int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *, 294int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
295 struct nfsd3_readdirargs *); 295 struct nfsd3_readdirargs *);
296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *, 296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
297 struct nfsd3_readdirargs *); 297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *, 298int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
299 struct nfsd3_commitargs *); 299 struct nfsd3_commitargs *);
300int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *); 300int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
301int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *, 301int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
302 struct nfsd3_attrstat *); 302 struct nfsd3_attrstat *);
303int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *, 303int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
304 struct nfsd3_attrstat *); 304 struct nfsd3_attrstat *);
305int nfs3svc_encode_diropres(struct svc_rqst *, u32 *, 305int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
306 struct nfsd3_diropres *); 306 struct nfsd3_diropres *);
307int nfs3svc_encode_accessres(struct svc_rqst *, u32 *, 307int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
308 struct nfsd3_accessres *); 308 struct nfsd3_accessres *);
309int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, 309int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
310 struct nfsd3_readlinkres *); 310 struct nfsd3_readlinkres *);
311int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); 311int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
312int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *); 312int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
313int nfs3svc_encode_createres(struct svc_rqst *, u32 *, 313int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
314 struct nfsd3_diropres *); 314 struct nfsd3_diropres *);
315int nfs3svc_encode_renameres(struct svc_rqst *, u32 *, 315int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
316 struct nfsd3_renameres *); 316 struct nfsd3_renameres *);
317int nfs3svc_encode_linkres(struct svc_rqst *, u32 *, 317int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
318 struct nfsd3_linkres *); 318 struct nfsd3_linkres *);
319int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, 319int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
320 struct nfsd3_readdirres *); 320 struct nfsd3_readdirres *);
321int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *, 321int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
322 struct nfsd3_fsstatres *); 322 struct nfsd3_fsstatres *);
323int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *, 323int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
324 struct nfsd3_fsinfores *); 324 struct nfsd3_fsinfores *);
325int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *, 325int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
326 struct nfsd3_pathconfres *); 326 struct nfsd3_pathconfres *);
327int nfs3svc_encode_commitres(struct svc_rqst *, u32 *, 327int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
328 struct nfsd3_commitres *); 328 struct nfsd3_commitres *);
329 329
330int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, 330int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *); 331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, 332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *); 333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(struct readdir_cd *, const char *name, 334int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
335 int namlen, loff_t offset, ino_t ino, 335 int namlen, loff_t offset, ino_t ino,
@@ -338,9 +338,9 @@ int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
338 int namlen, loff_t offset, ino_t ino, 338 int namlen, loff_t offset, ino_t ino,
339 unsigned int); 339 unsigned int);
340/* Helper functions for NFSv3 ACL code */ 340/* Helper functions for NFSv3 ACL code */
341u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, 341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342 struct svc_fh *fhp); 342 struct svc_fh *fhp);
343u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp); 343__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
344 344
345 345
346#endif /* _LINUX_NFSD_XDR3_H */ 346#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 66e642762a07..45ca01b5f844 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -258,9 +258,9 @@ struct nfsd4_readdir {
258 struct svc_fh * rd_fhp; /* response */ 258 struct svc_fh * rd_fhp; /* response */
259 259
260 struct readdir_cd common; 260 struct readdir_cd common;
261 u32 * buffer; 261 __be32 * buffer;
262 int buflen; 262 int buflen;
263 u32 * offset; 263 __be32 * offset;
264}; 264};
265 265
266struct nfsd4_release_lockowner { 266struct nfsd4_release_lockowner {
@@ -334,7 +334,7 @@ struct nfsd4_write {
334 334
335struct nfsd4_op { 335struct nfsd4_op {
336 int opnum; 336 int opnum;
337 int status; 337 __be32 status;
338 union { 338 union {
339 struct nfsd4_access access; 339 struct nfsd4_access access;
340 struct nfsd4_close close; 340 struct nfsd4_close close;
@@ -371,12 +371,12 @@ struct nfsd4_op {
371 371
372struct nfsd4_compoundargs { 372struct nfsd4_compoundargs {
373 /* scratch variables for XDR decode */ 373 /* scratch variables for XDR decode */
374 u32 * p; 374 __be32 * p;
375 u32 * end; 375 __be32 * end;
376 struct page ** pagelist; 376 struct page ** pagelist;
377 int pagelen; 377 int pagelen;
378 u32 tmp[8]; 378 __be32 tmp[8];
379 u32 * tmpp; 379 __be32 * tmpp;
380 struct tmpbuf { 380 struct tmpbuf {
381 struct tmpbuf *next; 381 struct tmpbuf *next;
382 void (*release)(const void *); 382 void (*release)(const void *);
@@ -395,15 +395,15 @@ struct nfsd4_compoundargs {
395 395
396struct nfsd4_compoundres { 396struct nfsd4_compoundres {
397 /* scratch variables for XDR encode */ 397 /* scratch variables for XDR encode */
398 u32 * p; 398 __be32 * p;
399 u32 * end; 399 __be32 * end;
400 struct xdr_buf * xbuf; 400 struct xdr_buf * xbuf;
401 struct svc_rqst * rqstp; 401 struct svc_rqst * rqstp;
402 402
403 u32 taglen; 403 u32 taglen;
404 char * tag; 404 char * tag;
405 u32 opcnt; 405 u32 opcnt;
406 u32 * tagp; /* where to encode tag and opcount */ 406 __be32 * tagp; /* where to encode tag and opcount */
407}; 407};
408 408
409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
@@ -419,45 +419,45 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec; 419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
420} 420}
421 421
422int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *); 422int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
423int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *, 423int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
424 struct nfsd4_compoundargs *); 424 struct nfsd4_compoundargs *);
425int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *, 425int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
426 struct nfsd4_compoundres *); 426 struct nfsd4_compoundres *);
427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); 428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
429int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 429__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
430 struct dentry *dentry, u32 *buffer, int *countp, 430 struct dentry *dentry, __be32 *buffer, int *countp,
431 u32 *bmval, struct svc_rqst *); 431 u32 *bmval, struct svc_rqst *);
432extern int nfsd4_setclientid(struct svc_rqst *rqstp, 432extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
433 struct nfsd4_setclientid *setclid); 433 struct nfsd4_setclientid *setclid);
434extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 434extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
435 struct nfsd4_setclientid_confirm *setclientid_confirm); 435 struct nfsd4_setclientid_confirm *setclientid_confirm);
436extern int nfsd4_process_open1(struct nfsd4_open *open); 436extern __be32 nfsd4_process_open1(struct nfsd4_open *open);
437extern int nfsd4_process_open2(struct svc_rqst *rqstp, 437extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
438 struct svc_fh *current_fh, struct nfsd4_open *open); 438 struct svc_fh *current_fh, struct nfsd4_open *open);
439extern int nfsd4_open_confirm(struct svc_rqst *rqstp, 439extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, 440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc,
441 struct nfs4_stateowner **); 441 struct nfs4_stateowner **);
442extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, 442extern __be32 nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
443 struct nfsd4_close *close, 443 struct nfsd4_close *close,
444 struct nfs4_stateowner **replay_owner); 444 struct nfs4_stateowner **replay_owner);
445extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, 445extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, 446 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od,
447 struct nfs4_stateowner **replay_owner); 447 struct nfs4_stateowner **replay_owner);
448extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, 448extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
449 struct nfsd4_lock *lock, 449 struct nfsd4_lock *lock,
450 struct nfs4_stateowner **replay_owner); 450 struct nfs4_stateowner **replay_owner);
451extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 451extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
452 struct nfsd4_lockt *lockt); 452 struct nfsd4_lockt *lockt);
453extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, 453extern __be32 nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
454 struct nfsd4_locku *locku, 454 struct nfsd4_locku *locku,
455 struct nfs4_stateowner **replay_owner); 455 struct nfs4_stateowner **replay_owner);
456extern int 456extern __be32
457nfsd4_release_lockowner(struct svc_rqst *rqstp, 457nfsd4_release_lockowner(struct svc_rqst *rqstp,
458 struct nfsd4_release_lockowner *rlockowner); 458 struct nfsd4_release_lockowner *rlockowner);
459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *); 459extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
460extern int nfsd4_delegreturn(struct svc_rqst *rqstp, 460extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr); 461 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
462#endif 462#endif
463 463
diff --git a/include/linux/oom.h b/include/linux/oom.h
new file mode 100644
index 000000000000..ad76463629a0
--- /dev/null
+++ b/include/linux/oom.h
@@ -0,0 +1,10 @@
1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H
3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
5#define OOM_DISABLE (-17)
6/* inclusive */
7#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15
9
10#endif
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 80d780e5a8f5..bf4cf2080e5c 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_PERSONALITY_H 1#ifndef _LINUX_PERSONALITY_H
2#define _LINUX_PERSONALITY_H 2#define _LINUX_PERSONALITY_H
3 3
4#ifdef __KERNEL__
5
4/* 6/*
5 * Handling of different ABIs (personalities). 7 * Handling of different ABIs (personalities).
6 */ 8 */
@@ -12,6 +14,8 @@ extern int register_exec_domain(struct exec_domain *);
12extern int unregister_exec_domain(struct exec_domain *); 14extern int unregister_exec_domain(struct exec_domain *);
13extern int __set_personality(unsigned long); 15extern int __set_personality(unsigned long);
14 16
17#endif /* __KERNEL__ */
18
15/* 19/*
16 * Flags for bug emulation. 20 * Flags for bug emulation.
17 * 21 *
@@ -71,6 +75,7 @@ enum {
71 PER_MASK = 0x00ff, 75 PER_MASK = 0x00ff,
72}; 76};
73 77
78#ifdef __KERNEL__
74 79
75/* 80/*
76 * Description of an execution domain. 81 * Description of an execution domain.
@@ -111,4 +116,6 @@ struct exec_domain {
111#define set_personality(pers) \ 116#define set_personality(pers) \
112 ((current->personality == pers) ? 0 : __set_personality(pers)) 117 ((current->personality == pers) ? 0 : __set_personality(pers))
113 118
119#endif /* __KERNEL__ */
120
114#endif /* _LINUX_PERSONALITY_H */ 121#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 9c9a8ad92477..965d6c20086e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -335,7 +335,7 @@ struct svc_version {
335/* 335/*
336 * RPC procedure info 336 * RPC procedure info
337 */ 337 */
338typedef int (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp); 338typedef __be32 (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
339struct svc_procedure { 339struct svc_procedure {
340 svc_procfunc pc_func; /* process the request */ 340 svc_procfunc pc_func; /* process the request */
341 kxdrproc_t pc_decode; /* XDR decode args */ 341 kxdrproc_t pc_decode; /* XDR decode args */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e058a2d1c6d..2d36f6db3706 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -342,6 +342,8 @@ struct tcp_sock {
342 342
343 unsigned long last_synq_overflow; 343 unsigned long last_synq_overflow;
344 344
345 __u32 tso_deferred;
346
345/* Receiver side RTT estimation */ 347/* Receiver side RTT estimation */
346 struct { 348 struct {
347 __u32 rtt; 349 __u32 rtt;
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 243a15f54002..bea469455a0c 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -129,6 +129,7 @@ static inline unsigned int tipc_node(__u32 addr)
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
132#if 0 133#if 0
133/* The following filter options are not currently implemented */ 134/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ 135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a341c8032866..fc35e6bdfb93 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -85,7 +85,6 @@ int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(void);
88void writeback_congestion_end(void);
89 88
90/* These are exported to sysctl. */ 89/* These are exported to sysctl. */
91extern int dirty_background_ratio; 90extern int dirty_background_ratio;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index f13cc0c2b163..aa10a8178e70 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -17,14 +17,15 @@
17 17
18struct inet_peer 18struct inet_peer
19{ 19{
20 /* group together avl_left,avl_right,v4daddr to speedup lookups */
20 struct inet_peer *avl_left, *avl_right; 21 struct inet_peer *avl_left, *avl_right;
22 __be32 v4daddr; /* peer's address */
23 __u16 avl_height;
24 __u16 ip_id_count; /* IP ID for the next packet */
21 struct inet_peer *unused_next, **unused_prevp; 25 struct inet_peer *unused_next, **unused_prevp;
22 __u32 dtime; /* the time of last use of not 26 __u32 dtime; /* the time of last use of not
23 * referenced entries */ 27 * referenced entries */
24 atomic_t refcnt; 28 atomic_t refcnt;
25 __be32 v4daddr; /* peer's address */
26 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */
28 atomic_t rid; /* Frag reception counter */ 29 atomic_t rid; /* Frag reception counter */
29 __u32 tcp_ts; 30 __u32 tcp_ts;
30 unsigned long tcp_ts_stamp; 31 unsigned long tcp_ts_stamp;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 6ca6b71dfe0f..c14b70ed4c57 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -36,13 +36,6 @@ struct route_info {
36#define RT6_LOOKUP_F_REACHABLE 0x2 36#define RT6_LOOKUP_F_REACHABLE 0x2
37#define RT6_LOOKUP_F_HAS_SADDR 0x4 37#define RT6_LOOKUP_F_HAS_SADDR 0x4
38 38
39struct pol_chain {
40 int type;
41 int priority;
42 struct fib6_node *rules;
43 struct pol_chain *next;
44};
45
46extern struct rt6_info ip6_null_entry; 39extern struct rt6_info ip6_null_entry;
47 40
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 41#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 82229146bac7..949b932d2f08 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -21,17 +21,14 @@
21#include <net/fib_rules.h> 21#include <net/fib_rules.h>
22 22
23struct fib_config { 23struct fib_config {
24 u8 fc_family;
25 u8 fc_dst_len; 24 u8 fc_dst_len;
26 u8 fc_src_len;
27 u8 fc_tos; 25 u8 fc_tos;
28 u8 fc_protocol; 26 u8 fc_protocol;
29 u8 fc_scope; 27 u8 fc_scope;
30 u8 fc_type; 28 u8 fc_type;
31 /* 1 byte unused */ 29 /* 3 bytes unused */
32 u32 fc_table; 30 u32 fc_table;
33 __be32 fc_dst; 31 __be32 fc_dst;
34 __be32 fc_src;
35 __be32 fc_gw; 32 __be32 fc_gw;
36 int fc_oif; 33 int fc_oif;
37 u32 fc_flags; 34 u32 fc_flags;
diff --git a/init/Kconfig b/init/Kconfig
index 10382931eead..c8b2624af176 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1,5 +1,6 @@
1config DEFCONFIG_LIST 1config DEFCONFIG_LIST
2 string 2 string
3 depends on !UML
3 option defconfig_list 4 option defconfig_list
4 default "/lib/modules/$UNAME_RELEASE/.config" 5 default "/lib/modules/$UNAME_RELEASE/.config"
5 default "/etc/kernel-config" 6 default "/etc/kernel-config"
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 6ebdb82a0ce4..674aceb7335a 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -44,11 +44,9 @@ static inline struct nsproxy *clone_namespaces(struct nsproxy *orig)
44{ 44{
45 struct nsproxy *ns; 45 struct nsproxy *ns;
46 46
47 ns = kmalloc(sizeof(struct nsproxy), GFP_KERNEL); 47 ns = kmemdup(orig, sizeof(struct nsproxy), GFP_KERNEL);
48 if (ns) { 48 if (ns)
49 memcpy(ns, orig, sizeof(struct nsproxy));
50 atomic_set(&ns->count, 1); 49 atomic_set(&ns->count, 1);
51 }
52 return ns; 50 return ns;
53} 51}
54 52
diff --git a/kernel/sched.c b/kernel/sched.c
index 094b5687eef6..3399701c680e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -160,15 +160,6 @@
160#define TASK_PREEMPTS_CURR(p, rq) \ 160#define TASK_PREEMPTS_CURR(p, rq) \
161 ((p)->prio < (rq)->curr->prio) 161 ((p)->prio < (rq)->curr->prio)
162 162
163/*
164 * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
165 * to time slice values: [800ms ... 100ms ... 5ms]
166 *
167 * The higher a thread's priority, the bigger timeslices
168 * it gets during one round of execution. But even the lowest
169 * priority thread gets MIN_TIMESLICE worth of execution time.
170 */
171
172#define SCALE_PRIO(x, prio) \ 163#define SCALE_PRIO(x, prio) \
173 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_TIMESLICE) 164 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_TIMESLICE)
174 165
@@ -180,6 +171,15 @@ static unsigned int static_prio_timeslice(int static_prio)
180 return SCALE_PRIO(DEF_TIMESLICE, static_prio); 171 return SCALE_PRIO(DEF_TIMESLICE, static_prio);
181} 172}
182 173
174/*
175 * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
176 * to time slice values: [800ms ... 100ms ... 5ms]
177 *
178 * The higher a thread's priority, the bigger timeslices
179 * it gets during one round of execution. But even the lowest
180 * priority thread gets MIN_TIMESLICE worth of execution time.
181 */
182
183static inline unsigned int task_timeslice(struct task_struct *p) 183static inline unsigned int task_timeslice(struct task_struct *p)
184{ 184{
185 return static_prio_timeslice(p->static_prio); 185 return static_prio_timeslice(p->static_prio);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8020fb273c4f..8bff2c18fb5a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -136,8 +136,10 @@ static int parse_table(int __user *, int, void __user *, size_t __user *,
136static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, 136static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 137 void __user *buffer, size_t *lenp, loff_t *ppos);
138 138
139#ifdef CONFIG_PROC_SYSCTL
139static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 140static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
140 void __user *buffer, size_t *lenp, loff_t *ppos); 141 void __user *buffer, size_t *lenp, loff_t *ppos);
142#endif
141 143
142static ctl_table root_table[]; 144static ctl_table root_table[];
143static struct ctl_table_header root_table_header = 145static struct ctl_table_header root_table_header =
@@ -542,6 +544,7 @@ static ctl_table kern_table[] = {
542 .proc_handler = &proc_dointvec, 544 .proc_handler = &proc_dointvec,
543 }, 545 },
544#endif 546#endif
547#ifdef CONFIG_PROC_SYSCTL
545 { 548 {
546 .ctl_name = KERN_CADPID, 549 .ctl_name = KERN_CADPID,
547 .procname = "cad_pid", 550 .procname = "cad_pid",
@@ -550,6 +553,7 @@ static ctl_table kern_table[] = {
550 .mode = 0600, 553 .mode = 0600,
551 .proc_handler = &proc_do_cad_pid, 554 .proc_handler = &proc_do_cad_pid,
552 }, 555 },
556#endif
553 { 557 {
554 .ctl_name = KERN_MAX_THREADS, 558 .ctl_name = KERN_MAX_THREADS,
555 .procname = "threads-max", 559 .procname = "threads-max",
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 7a2a73f88d59..3a67dc5ada7d 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -43,19 +43,3 @@ int __any_online_cpu(const cpumask_t *mask)
43 return cpu; 43 return cpu;
44} 44}
45EXPORT_SYMBOL(__any_online_cpu); 45EXPORT_SYMBOL(__any_online_cpu);
46
47#if MAX_NUMNODES > 1
48/*
49 * Find the highest possible node id.
50 */
51int highest_possible_node_id(void)
52{
53 unsigned int node;
54 unsigned int highest = 0;
55
56 for_each_node_mask(node, node_possible_map)
57 highest = node;
58 return highest;
59}
60EXPORT_SYMBOL(highest_possible_node_id);
61#endif
diff --git a/mm/Makefile b/mm/Makefile
index 12b3a4eee88d..f3c077eb0b8e 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -10,7 +10,8 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ 10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
11 page_alloc.o page-writeback.o pdflush.o \ 11 page_alloc.o page-writeback.o pdflush.o \
12 readahead.o swap.o truncate.o vmscan.o \ 12 readahead.o swap.o truncate.o vmscan.o \
13 prio_tree.o util.o mmzone.o vmstat.o $(mmu-y) 13 prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
14 $(mmu-y)
14 15
15ifeq ($(CONFIG_MMU)$(CONFIG_BLOCK),yy) 16ifeq ($(CONFIG_MMU)$(CONFIG_BLOCK),yy)
16obj-y += bounce.o 17obj-y += bounce.o
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
new file mode 100644
index 000000000000..f50a2811f9dc
--- /dev/null
+++ b/mm/backing-dev.c
@@ -0,0 +1,69 @@
1
2#include <linux/wait.h>
3#include <linux/backing-dev.h>
4#include <linux/fs.h>
5#include <linux/sched.h>
6#include <linux/module.h>
7
8static wait_queue_head_t congestion_wqh[2] = {
9 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
10 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
11 };
12
13
14void clear_bdi_congested(struct backing_dev_info *bdi, int rw)
15{
16 enum bdi_state bit;
17 wait_queue_head_t *wqh = &congestion_wqh[rw];
18
19 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
20 clear_bit(bit, &bdi->state);
21 smp_mb__after_clear_bit();
22 if (waitqueue_active(wqh))
23 wake_up(wqh);
24}
25EXPORT_SYMBOL(clear_bdi_congested);
26
27void set_bdi_congested(struct backing_dev_info *bdi, int rw)
28{
29 enum bdi_state bit;
30
31 bit = (rw == WRITE) ? BDI_write_congested : BDI_read_congested;
32 set_bit(bit, &bdi->state);
33}
34EXPORT_SYMBOL(set_bdi_congested);
35
36/**
37 * congestion_wait - wait for a backing_dev to become uncongested
38 * @rw: READ or WRITE
39 * @timeout: timeout in jiffies
40 *
41 * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit
42 * write congestion. If no backing_devs are congested then just wait for the
43 * next write to be completed.
44 */
45long congestion_wait(int rw, long timeout)
46{
47 long ret;
48 DEFINE_WAIT(wait);
49 wait_queue_head_t *wqh = &congestion_wqh[rw];
50
51 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
52 ret = io_schedule_timeout(timeout);
53 finish_wait(wqh, &wait);
54 return ret;
55}
56EXPORT_SYMBOL(congestion_wait);
57
58/**
59 * congestion_end - wake up sleepers on a congested backing_dev_info
60 * @rw: READ or WRITE
61 */
62void congestion_end(int rw)
63{
64 wait_queue_head_t *wqh = &congestion_wqh[rw];
65
66 if (waitqueue_active(wqh))
67 wake_up(wqh);
68}
69EXPORT_SYMBOL(congestion_end);
diff --git a/mm/filemap.c b/mm/filemap.c
index 3464b681f844..8558732e85c1 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -75,8 +75,8 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
75 * ->mmap_sem 75 * ->mmap_sem
76 * ->lock_page (access_process_vm) 76 * ->lock_page (access_process_vm)
77 * 77 *
78 * ->mmap_sem 78 * ->i_mutex (generic_file_buffered_write)
79 * ->i_mutex (msync) 79 * ->mmap_sem (fault_in_pages_readable->do_page_fault)
80 * 80 *
81 * ->i_mutex 81 * ->i_mutex
82 * ->i_alloc_sem (various) 82 * ->i_alloc_sem (various)
@@ -2222,7 +2222,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2222 unsigned long nr_segs, loff_t *ppos) 2222 unsigned long nr_segs, loff_t *ppos)
2223{ 2223{
2224 struct file *file = iocb->ki_filp; 2224 struct file *file = iocb->ki_filp;
2225 const struct address_space * mapping = file->f_mapping; 2225 struct address_space * mapping = file->f_mapping;
2226 size_t ocount; /* original count */ 2226 size_t ocount; /* original count */
2227 size_t count; /* after file limit checks */ 2227 size_t count; /* after file limit checks */
2228 struct inode *inode = mapping->host; 2228 struct inode *inode = mapping->host;
@@ -2275,8 +2275,11 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2275 2275
2276 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ 2276 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
2277 if (unlikely(file->f_flags & O_DIRECT)) { 2277 if (unlikely(file->f_flags & O_DIRECT)) {
2278 written = generic_file_direct_write(iocb, iov, 2278 loff_t endbyte;
2279 &nr_segs, pos, ppos, count, ocount); 2279 ssize_t written_buffered;
2280
2281 written = generic_file_direct_write(iocb, iov, &nr_segs, pos,
2282 ppos, count, ocount);
2280 if (written < 0 || written == count) 2283 if (written < 0 || written == count)
2281 goto out; 2284 goto out;
2282 /* 2285 /*
@@ -2285,10 +2288,46 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2285 */ 2288 */
2286 pos += written; 2289 pos += written;
2287 count -= written; 2290 count -= written;
2288 } 2291 written_buffered = generic_file_buffered_write(iocb, iov,
2292 nr_segs, pos, ppos, count,
2293 written);
2294 /*
2295 * If generic_file_buffered_write() retuned a synchronous error
2296 * then we want to return the number of bytes which were
2297 * direct-written, or the error code if that was zero. Note
2298 * that this differs from normal direct-io semantics, which
2299 * will return -EFOO even if some bytes were written.
2300 */
2301 if (written_buffered < 0) {
2302 err = written_buffered;
2303 goto out;
2304 }
2289 2305
2290 written = generic_file_buffered_write(iocb, iov, nr_segs, 2306 /*
2291 pos, ppos, count, written); 2307 * We need to ensure that the page cache pages are written to
2308 * disk and invalidated to preserve the expected O_DIRECT
2309 * semantics.
2310 */
2311 endbyte = pos + written_buffered - written - 1;
2312 err = do_sync_file_range(file, pos, endbyte,
2313 SYNC_FILE_RANGE_WAIT_BEFORE|
2314 SYNC_FILE_RANGE_WRITE|
2315 SYNC_FILE_RANGE_WAIT_AFTER);
2316 if (err == 0) {
2317 written = written_buffered;
2318 invalidate_mapping_pages(mapping,
2319 pos >> PAGE_CACHE_SHIFT,
2320 endbyte >> PAGE_CACHE_SHIFT);
2321 } else {
2322 /*
2323 * We don't know how much we wrote, so just return
2324 * the number of bytes which were direct-written
2325 */
2326 }
2327 } else {
2328 written = generic_file_buffered_write(iocb, iov, nr_segs,
2329 pos, ppos, count, written);
2330 }
2292out: 2331out:
2293 current->backing_dev_info = NULL; 2332 current->backing_dev_info = NULL;
2294 return written ? written : err; 2333 return written ? written : err;
diff --git a/mm/memory.c b/mm/memory.c
index b5a4aadd961a..156861fcac43 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1452,6 +1452,7 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo
1452 if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) 1452 if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE))
1453 memset(kaddr, 0, PAGE_SIZE); 1453 memset(kaddr, 0, PAGE_SIZE);
1454 kunmap_atomic(kaddr, KM_USER0); 1454 kunmap_atomic(kaddr, KM_USER0);
1455 flush_dcache_page(dst);
1455 return; 1456 return;
1456 1457
1457 } 1458 }
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 20f41b082e16..2e3ce3a928b9 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -15,6 +15,7 @@
15 * kernel subsystems and hints as to where to find out what things do. 15 * kernel subsystems and hints as to where to find out what things do.
16 */ 16 */
17 17
18#include <linux/oom.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/swap.h> 21#include <linux/swap.h>
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index a0f339057449..8d9b19f239c3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -222,7 +222,7 @@ static void balance_dirty_pages(struct address_space *mapping)
222 if (pages_written >= write_chunk) 222 if (pages_written >= write_chunk)
223 break; /* We've done our duty */ 223 break; /* We've done our duty */
224 } 224 }
225 blk_congestion_wait(WRITE, HZ/10); 225 congestion_wait(WRITE, HZ/10);
226 } 226 }
227 227
228 if (nr_reclaimable + global_page_state(NR_WRITEBACK) 228 if (nr_reclaimable + global_page_state(NR_WRITEBACK)
@@ -314,7 +314,7 @@ void throttle_vm_writeout(void)
314 if (global_page_state(NR_UNSTABLE_NFS) + 314 if (global_page_state(NR_UNSTABLE_NFS) +
315 global_page_state(NR_WRITEBACK) <= dirty_thresh) 315 global_page_state(NR_WRITEBACK) <= dirty_thresh)
316 break; 316 break;
317 blk_congestion_wait(WRITE, HZ/10); 317 congestion_wait(WRITE, HZ/10);
318 } 318 }
319} 319}
320 320
@@ -351,7 +351,7 @@ static void background_writeout(unsigned long _min_pages)
351 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; 351 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
352 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 352 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
353 /* Wrote less than expected */ 353 /* Wrote less than expected */
354 blk_congestion_wait(WRITE, HZ/10); 354 congestion_wait(WRITE, HZ/10);
355 if (!wbc.encountered_congestion) 355 if (!wbc.encountered_congestion)
356 break; 356 break;
357 } 357 }
@@ -422,7 +422,7 @@ static void wb_kupdate(unsigned long arg)
422 writeback_inodes(&wbc); 422 writeback_inodes(&wbc);
423 if (wbc.nr_to_write > 0) { 423 if (wbc.nr_to_write > 0) {
424 if (wbc.encountered_congestion) 424 if (wbc.encountered_congestion)
425 blk_congestion_wait(WRITE, HZ/10); 425 congestion_wait(WRITE, HZ/10);
426 else 426 else
427 break; /* All the old data is written */ 427 break; /* All the old data is written */
428 } 428 }
@@ -956,15 +956,6 @@ int test_set_page_writeback(struct page *page)
956EXPORT_SYMBOL(test_set_page_writeback); 956EXPORT_SYMBOL(test_set_page_writeback);
957 957
958/* 958/*
959 * Wakes up tasks that are being throttled due to writeback congestion
960 */
961void writeback_congestion_end(void)
962{
963 blk_congestion_end(WRITE);
964}
965EXPORT_SYMBOL(writeback_congestion_end);
966
967/*
968 * Return true if any of the pages in the mapping are marged with the 959 * Return true if any of the pages in the mapping are marged with the
969 * passed tag. 960 * passed tag.
970 */ 961 */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 40db96a655d0..ebd425c2e2a7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -39,6 +39,7 @@
39#include <linux/stop_machine.h> 39#include <linux/stop_machine.h>
40#include <linux/sort.h> 40#include <linux/sort.h>
41#include <linux/pfn.h> 41#include <linux/pfn.h>
42#include <linux/backing-dev.h>
42 43
43#include <asm/tlbflush.h> 44#include <asm/tlbflush.h>
44#include <asm/div64.h> 45#include <asm/div64.h>
@@ -1050,7 +1051,7 @@ nofail_alloc:
1050 if (page) 1051 if (page)
1051 goto got_pg; 1052 goto got_pg;
1052 if (gfp_mask & __GFP_NOFAIL) { 1053 if (gfp_mask & __GFP_NOFAIL) {
1053 blk_congestion_wait(WRITE, HZ/50); 1054 congestion_wait(WRITE, HZ/50);
1054 goto nofail_alloc; 1055 goto nofail_alloc;
1055 } 1056 }
1056 } 1057 }
@@ -1113,7 +1114,7 @@ rebalance:
1113 do_retry = 1; 1114 do_retry = 1;
1114 } 1115 }
1115 if (do_retry) { 1116 if (do_retry) {
1116 blk_congestion_wait(WRITE, HZ/50); 1117 congestion_wait(WRITE, HZ/50);
1117 goto rebalance; 1118 goto rebalance;
1118 } 1119 }
1119 1120
@@ -3119,3 +3120,19 @@ unsigned long page_to_pfn(struct page *page)
3119EXPORT_SYMBOL(pfn_to_page); 3120EXPORT_SYMBOL(pfn_to_page);
3120EXPORT_SYMBOL(page_to_pfn); 3121EXPORT_SYMBOL(page_to_pfn);
3121#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ 3122#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
3123
3124#if MAX_NUMNODES > 1
3125/*
3126 * Find the highest possible node id.
3127 */
3128int highest_possible_node_id(void)
3129{
3130 unsigned int node;
3131 unsigned int highest = 0;
3132
3133 for_each_node_mask(node, node_possible_map)
3134 highest = node;
3135 return highest;
3136}
3137EXPORT_SYMBOL(highest_possible_node_id);
3138#endif
diff --git a/mm/rmap.c b/mm/rmap.c
index a9136d8b7577..d8a842a586db 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -21,27 +21,21 @@
21 * Lock ordering in mm: 21 * Lock ordering in mm:
22 * 22 *
23 * inode->i_mutex (while writing or truncating, not reading or faulting) 23 * inode->i_mutex (while writing or truncating, not reading or faulting)
24 * inode->i_alloc_sem 24 * inode->i_alloc_sem (vmtruncate_range)
25 * 25 * mm->mmap_sem
26 * When a page fault occurs in writing from user to file, down_read 26 * page->flags PG_locked (lock_page)
27 * of mmap_sem nests within i_mutex; in sys_msync, i_mutex nests within 27 * mapping->i_mmap_lock
28 * down_read of mmap_sem; i_mutex and down_write of mmap_sem are never 28 * anon_vma->lock
29 * taken together; in truncation, i_mutex is taken outermost. 29 * mm->page_table_lock or pte_lock
30 * 30 * zone->lru_lock (in mark_page_accessed, isolate_lru_page)
31 * mm->mmap_sem 31 * swap_lock (in swap_duplicate, swap_info_get)
32 * page->flags PG_locked (lock_page) 32 * mmlist_lock (in mmput, drain_mmlist and others)
33 * mapping->i_mmap_lock 33 * mapping->private_lock (in __set_page_dirty_buffers)
34 * anon_vma->lock 34 * inode_lock (in set_page_dirty's __mark_inode_dirty)
35 * mm->page_table_lock or pte_lock 35 * sb_lock (within inode_lock in fs/fs-writeback.c)
36 * zone->lru_lock (in mark_page_accessed, isolate_lru_page) 36 * mapping->tree_lock (widely used, in set_page_dirty,
37 * swap_lock (in swap_duplicate, swap_info_get) 37 * in arch-dependent flush_dcache_mmap_lock,
38 * mmlist_lock (in mmput, drain_mmlist and others) 38 * within inode_lock in __sync_single_inode)
39 * mapping->private_lock (in __set_page_dirty_buffers)
40 * inode_lock (in set_page_dirty's __mark_inode_dirty)
41 * sb_lock (within inode_lock in fs/fs-writeback.c)
42 * mapping->tree_lock (widely used, in set_page_dirty,
43 * in arch-dependent flush_dcache_mmap_lock,
44 * within inode_lock in __sync_single_inode)
45 */ 39 */
46 40
47#include <linux/mm.h> 41#include <linux/mm.h>
diff --git a/mm/shmem.c b/mm/shmem.c
index b378f66cf2f9..4959535fc14c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -48,6 +48,7 @@
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/migrate.h> 49#include <linux/migrate.h>
50#include <linux/highmem.h> 50#include <linux/highmem.h>
51#include <linux/backing-dev.h>
51 52
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/div64.h> 54#include <asm/div64.h>
@@ -1131,7 +1132,7 @@ repeat:
1131 page_cache_release(swappage); 1132 page_cache_release(swappage);
1132 if (error == -ENOMEM) { 1133 if (error == -ENOMEM) {
1133 /* let kswapd refresh zone for GFP_ATOMICs */ 1134 /* let kswapd refresh zone for GFP_ATOMICs */
1134 blk_congestion_wait(WRITE, HZ/50); 1135 congestion_wait(WRITE, HZ/50);
1135 } 1136 }
1136 goto repeat; 1137 goto repeat;
1137 } 1138 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index af73c14f9d88..f05527bf792b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1059,7 +1059,7 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1059 1059
1060 /* Take a nap, wait for some writeback to complete */ 1060 /* Take a nap, wait for some writeback to complete */
1061 if (sc.nr_scanned && priority < DEF_PRIORITY - 2) 1061 if (sc.nr_scanned && priority < DEF_PRIORITY - 2)
1062 blk_congestion_wait(WRITE, HZ/10); 1062 congestion_wait(WRITE, HZ/10);
1063 } 1063 }
1064 /* top priority shrink_caches still had more to do? don't OOM, then */ 1064 /* top priority shrink_caches still had more to do? don't OOM, then */
1065 if (!sc.all_unreclaimable) 1065 if (!sc.all_unreclaimable)
@@ -1214,7 +1214,7 @@ scan:
1214 * another pass across the zones. 1214 * another pass across the zones.
1215 */ 1215 */
1216 if (total_scanned && priority < DEF_PRIORITY - 2) 1216 if (total_scanned && priority < DEF_PRIORITY - 2)
1217 blk_congestion_wait(WRITE, HZ/10); 1217 congestion_wait(WRITE, HZ/10);
1218 1218
1219 /* 1219 /*
1220 * We do this so kswapd doesn't build up large priorities for 1220 * We do this so kswapd doesn't build up large priorities for
@@ -1458,7 +1458,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
1458 goto out; 1458 goto out;
1459 1459
1460 if (sc.nr_scanned && prio < DEF_PRIORITY - 2) 1460 if (sc.nr_scanned && prio < DEF_PRIORITY - 2)
1461 blk_congestion_wait(WRITE, HZ / 10); 1461 congestion_wait(WRITE, HZ / 10);
1462 } 1462 }
1463 1463
1464 lru_pages = 0; 1464 lru_pages = 0;
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 9a562cf7406b..66782010f82c 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -507,12 +507,10 @@ static int hidp_session(void *arg)
507 507
508 hidp_del_timer(session); 508 hidp_del_timer(session);
509 509
510 if (intr_sk->sk_state != BT_CONNECTED)
511 wait_event_timeout(*(ctrl_sk->sk_sleep), (ctrl_sk->sk_state == BT_CLOSED), HZ);
512
513 fput(session->intr_sock->file); 510 fput(session->intr_sock->file);
514 511
515 wait_event_timeout(*(intr_sk->sk_sleep), (intr_sk->sk_state == BT_CLOSED), HZ); 512 wait_event_timeout(*(ctrl_sk->sk_sleep),
513 (ctrl_sk->sk_state == BT_CLOSED), msecs_to_jiffies(500));
516 514
517 fput(session->ctrl_sock->file); 515 fput(session->ctrl_sock->file);
518 516
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index ead5920c26d6..9308af060b44 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -335,13 +335,13 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
335 memcpy(skb->data, msg, len); 335 memcpy(skb->data, msg, len);
336 skb->len += len; 336 skb->len += len;
337 337
338 udph = (struct udphdr *) skb_push(skb, sizeof(*udph)); 338 skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph));
339 udph->source = htons(np->local_port); 339 udph->source = htons(np->local_port);
340 udph->dest = htons(np->remote_port); 340 udph->dest = htons(np->remote_port);
341 udph->len = htons(udp_len); 341 udph->len = htons(udp_len);
342 udph->check = 0; 342 udph->check = 0;
343 343
344 iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); 344 skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
345 345
346 /* iph->version = 4; iph->ihl = 5; */ 346 /* iph->version = 4; iph->ihl = 5; */
347 put_unaligned(0x45, (unsigned char *)iph); 347 put_unaligned(0x45, (unsigned char *)iph);
@@ -357,8 +357,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
357 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); 357 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
358 358
359 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); 359 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
360 360 skb->mac.raw = skb->data;
361 eth->h_proto = htons(ETH_P_IP); 361 skb->protocol = eth->h_proto = htons(ETH_P_IP);
362 memcpy(eth->h_source, np->local_mac, 6); 362 memcpy(eth->h_source, np->local_mac, 6);
363 memcpy(eth->h_dest, np->remote_mac, 6); 363 memcpy(eth->h_dest, np->remote_mac, 6);
364 364
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 491429ce9394..23489f7232d2 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1275,7 +1275,6 @@ static int dn_route_input_slow(struct sk_buff *skb)
1275 goto e_inval; 1275 goto e_inval;
1276 1276
1277 res.type = RTN_LOCAL; 1277 res.type = RTN_LOCAL;
1278 flags |= RTCF_DIRECTSRC;
1279 } else { 1278 } else {
1280 __le16 src_map = fl.fld_src; 1279 __le16 src_map = fl.fld_src;
1281 free_res = 1; 1280 free_res = 1;
@@ -1346,7 +1345,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
1346 goto make_route; 1345 goto make_route;
1347 1346
1348 /* Packet was intra-ethernet, so we know its on-link */ 1347 /* Packet was intra-ethernet, so we know its on-link */
1349 if (cb->rt_flags | DN_RT_F_IE) { 1348 if (cb->rt_flags & DN_RT_F_IE) {
1350 gateway = cb->src; 1349 gateway = cb->src;
1351 flags |= RTCF_DIRECTSRC; 1350 flags |= RTCF_DIRECTSRC;
1352 goto make_route; 1351 goto make_route;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 9c399a70dd5d..af0190d8b6c0 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -482,9 +482,7 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
482 memset(cfg, 0, sizeof(*cfg)); 482 memset(cfg, 0, sizeof(*cfg));
483 483
484 rtm = nlmsg_data(nlh); 484 rtm = nlmsg_data(nlh);
485 cfg->fc_family = rtm->rtm_family;
486 cfg->fc_dst_len = rtm->rtm_dst_len; 485 cfg->fc_dst_len = rtm->rtm_dst_len;
487 cfg->fc_src_len = rtm->rtm_src_len;
488 cfg->fc_tos = rtm->rtm_tos; 486 cfg->fc_tos = rtm->rtm_tos;
489 cfg->fc_table = rtm->rtm_table; 487 cfg->fc_table = rtm->rtm_table;
490 cfg->fc_protocol = rtm->rtm_protocol; 488 cfg->fc_protocol = rtm->rtm_protocol;
@@ -501,9 +499,6 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
501 case RTA_DST: 499 case RTA_DST:
502 cfg->fc_dst = nla_get_be32(attr); 500 cfg->fc_dst = nla_get_be32(attr);
503 break; 501 break;
504 case RTA_SRC:
505 cfg->fc_src = nla_get_be32(attr);
506 break;
507 case RTA_OIF: 502 case RTA_OIF:
508 cfg->fc_oif = nla_get_u32(attr); 503 cfg->fc_oif = nla_get_u32(attr);
509 break; 504 break;
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 78a44b01c035..4b90927619b8 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1932,6 +1932,9 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1932{ 1932{
1933 int ret; 1933 int ret;
1934 1934
1935 if (!capable(CAP_NET_ADMIN))
1936 return -EPERM;
1937
1935 switch (cmd) { 1938 switch (cmd) {
1936 case IPT_SO_GET_INFO: 1939 case IPT_SO_GET_INFO:
1937 ret = get_info(user, len, 1); 1940 ret = get_info(user, len, 1);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6bbd98575172..22ef8bd26620 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -373,7 +373,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
373 seq = ntohl(th->seq); 373 seq = ntohl(th->seq);
374 if (sk->sk_state != TCP_LISTEN && 374 if (sk->sk_state != TCP_LISTEN &&
375 !between(seq, tp->snd_una, tp->snd_nxt)) { 375 !between(seq, tp->snd_una, tp->snd_nxt)) {
376 NET_INC_STATS(LINUX_MIB_OUTOFWINDOWICMPS); 376 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
377 goto out; 377 goto out;
378 } 378 }
379 379
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f22536e32cb1..ca406157724c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1096,10 +1096,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1096 u32 send_win, cong_win, limit, in_flight; 1096 u32 send_win, cong_win, limit, in_flight;
1097 1097
1098 if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) 1098 if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)
1099 return 0; 1099 goto send_now;
1100 1100
1101 if (icsk->icsk_ca_state != TCP_CA_Open) 1101 if (icsk->icsk_ca_state != TCP_CA_Open)
1102 return 0; 1102 goto send_now;
1103
1104 /* Defer for less than two clock ticks. */
1105 if (!tp->tso_deferred && ((jiffies<<1)>>1) - (tp->tso_deferred>>1) > 1)
1106 goto send_now;
1103 1107
1104 in_flight = tcp_packets_in_flight(tp); 1108 in_flight = tcp_packets_in_flight(tp);
1105 1109
@@ -1115,7 +1119,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1115 1119
1116 /* If a full-sized TSO skb can be sent, do it. */ 1120 /* If a full-sized TSO skb can be sent, do it. */
1117 if (limit >= 65536) 1121 if (limit >= 65536)
1118 return 0; 1122 goto send_now;
1119 1123
1120 if (sysctl_tcp_tso_win_divisor) { 1124 if (sysctl_tcp_tso_win_divisor) {
1121 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); 1125 u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);
@@ -1125,7 +1129,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1125 */ 1129 */
1126 chunk /= sysctl_tcp_tso_win_divisor; 1130 chunk /= sysctl_tcp_tso_win_divisor;
1127 if (limit >= chunk) 1131 if (limit >= chunk)
1128 return 0; 1132 goto send_now;
1129 } else { 1133 } else {
1130 /* Different approach, try not to defer past a single 1134 /* Different approach, try not to defer past a single
1131 * ACK. Receiver should ACK every other full sized 1135 * ACK. Receiver should ACK every other full sized
@@ -1133,11 +1137,17 @@ static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_
1133 * then send now. 1137 * then send now.
1134 */ 1138 */
1135 if (limit > tcp_max_burst(tp) * tp->mss_cache) 1139 if (limit > tcp_max_burst(tp) * tp->mss_cache)
1136 return 0; 1140 goto send_now;
1137 } 1141 }
1138 1142
1139 /* Ok, it looks like it is advisable to defer. */ 1143 /* Ok, it looks like it is advisable to defer. */
1144 tp->tso_deferred = 1 | (jiffies<<1);
1145
1140 return 1; 1146 return 1;
1147
1148send_now:
1149 tp->tso_deferred = 0;
1150 return 0;
1141} 1151}
1142 1152
1143/* Create a new MTU probe if we are ready. 1153/* Create a new MTU probe if we are ready.
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index ef5eaad44851..6e48f52e197c 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -175,9 +175,16 @@ config IPV6_TUNNEL
175 175
176 If unsure, say N. 176 If unsure, say N.
177 177
178config IPV6_MULTIPLE_TABLES
179 bool "IPv6: Multiple Routing Tables"
180 depends on IPV6 && EXPERIMENTAL
181 select FIB_RULES
182 ---help---
183 Support multiple routing tables.
184
178config IPV6_SUBTREES 185config IPV6_SUBTREES
179 bool "IPv6: source address based routing" 186 bool "IPv6: source address based routing"
180 depends on IPV6 && EXPERIMENTAL 187 depends on IPV6_MULTIPLE_TABLES
181 ---help--- 188 ---help---
182 Enable routing by source address or prefix. 189 Enable routing by source address or prefix.
183 190
@@ -189,13 +196,6 @@ config IPV6_SUBTREES
189 196
190 If unsure, say N. 197 If unsure, say N.
191 198
192config IPV6_MULTIPLE_TABLES
193 bool "IPv6: Multiple Routing Tables"
194 depends on IPV6 && EXPERIMENTAL
195 select FIB_RULES
196 ---help---
197 Support multiple routing tables.
198
199config IPV6_ROUTE_FWMARK 199config IPV6_ROUTE_FWMARK
200 bool "IPv6: use netfilter MARK value as routing key" 200 bool "IPv6: use netfilter MARK value as routing key"
201 depends on IPV6_MULTIPLE_TABLES && NETFILTER 201 depends on IPV6_MULTIPLE_TABLES && NETFILTER
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a1b0f075462e..c953466b7afd 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -141,6 +141,10 @@ struct rt6_info ip6_null_entry = {
141 141
142#ifdef CONFIG_IPV6_MULTIPLE_TABLES 142#ifdef CONFIG_IPV6_MULTIPLE_TABLES
143 143
144static int ip6_pkt_prohibit(struct sk_buff *skb);
145static int ip6_pkt_prohibit_out(struct sk_buff *skb);
146static int ip6_pkt_blk_hole(struct sk_buff *skb);
147
144struct rt6_info ip6_prohibit_entry = { 148struct rt6_info ip6_prohibit_entry = {
145 .u = { 149 .u = {
146 .dst = { 150 .dst = {
@@ -150,8 +154,8 @@ struct rt6_info ip6_prohibit_entry = {
150 .obsolete = -1, 154 .obsolete = -1,
151 .error = -EACCES, 155 .error = -EACCES,
152 .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, 156 .metrics = { [RTAX_HOPLIMIT - 1] = 255, },
153 .input = ip6_pkt_discard, 157 .input = ip6_pkt_prohibit,
154 .output = ip6_pkt_discard_out, 158 .output = ip6_pkt_prohibit_out,
155 .ops = &ip6_dst_ops, 159 .ops = &ip6_dst_ops,
156 .path = (struct dst_entry*)&ip6_prohibit_entry, 160 .path = (struct dst_entry*)&ip6_prohibit_entry,
157 } 161 }
@@ -170,8 +174,8 @@ struct rt6_info ip6_blk_hole_entry = {
170 .obsolete = -1, 174 .obsolete = -1,
171 .error = -EINVAL, 175 .error = -EINVAL,
172 .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, 176 .metrics = { [RTAX_HOPLIMIT - 1] = 255, },
173 .input = ip6_pkt_discard, 177 .input = ip6_pkt_blk_hole,
174 .output = ip6_pkt_discard_out, 178 .output = ip6_pkt_blk_hole,
175 .ops = &ip6_dst_ops, 179 .ops = &ip6_dst_ops,
176 .path = (struct dst_entry*)&ip6_blk_hole_entry, 180 .path = (struct dst_entry*)&ip6_blk_hole_entry,
177 } 181 }
@@ -484,7 +488,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
484do { \ 488do { \
485 if (rt == &ip6_null_entry) { \ 489 if (rt == &ip6_null_entry) { \
486 struct fib6_node *pn; \ 490 struct fib6_node *pn; \
487 while (fn) { \ 491 while (1) { \
488 if (fn->fn_flags & RTN_TL_ROOT) \ 492 if (fn->fn_flags & RTN_TL_ROOT) \
489 goto out; \ 493 goto out; \
490 pn = fn->parent; \ 494 pn = fn->parent; \
@@ -618,8 +622,6 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *d
618 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr); 622 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr);
619 rt->rt6i_dst.plen = 128; 623 rt->rt6i_dst.plen = 128;
620 rt->rt6i_flags |= RTF_CACHE; 624 rt->rt6i_flags |= RTF_CACHE;
621 if (rt->rt6i_flags & RTF_REJECT)
622 rt->u.dst.error = ort->u.dst.error;
623 rt->u.dst.flags |= DST_HOST; 625 rt->u.dst.flags |= DST_HOST;
624 rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop); 626 rt->rt6i_nexthop = neigh_clone(ort->rt6i_nexthop);
625 } 627 }
@@ -1540,6 +1542,7 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
1540 rt->u.dst.output = ort->u.dst.output; 1542 rt->u.dst.output = ort->u.dst.output;
1541 1543
1542 memcpy(rt->u.dst.metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32)); 1544 memcpy(rt->u.dst.metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32));
1545 rt->u.dst.error = ort->u.dst.error;
1543 rt->u.dst.dev = ort->u.dst.dev; 1546 rt->u.dst.dev = ort->u.dst.dev;
1544 if (rt->u.dst.dev) 1547 if (rt->u.dst.dev)
1545 dev_hold(rt->u.dst.dev); 1548 dev_hold(rt->u.dst.dev);
@@ -1743,24 +1746,50 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
1743 * Drop the packet on the floor 1746 * Drop the packet on the floor
1744 */ 1747 */
1745 1748
1746static int ip6_pkt_discard(struct sk_buff *skb) 1749static inline int ip6_pkt_drop(struct sk_buff *skb, int code)
1747{ 1750{
1748 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); 1751 int type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
1749 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) 1752 if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED)
1750 IP6_INC_STATS(IPSTATS_MIB_INADDRERRORS); 1753 IP6_INC_STATS(IPSTATS_MIB_INADDRERRORS);
1751 1754
1752 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES); 1755 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
1753 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); 1756 icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
1754 kfree_skb(skb); 1757 kfree_skb(skb);
1755 return 0; 1758 return 0;
1756} 1759}
1757 1760
1761static int ip6_pkt_discard(struct sk_buff *skb)
1762{
1763 return ip6_pkt_drop(skb, ICMPV6_NOROUTE);
1764}
1765
1758static int ip6_pkt_discard_out(struct sk_buff *skb) 1766static int ip6_pkt_discard_out(struct sk_buff *skb)
1759{ 1767{
1760 skb->dev = skb->dst->dev; 1768 skb->dev = skb->dst->dev;
1761 return ip6_pkt_discard(skb); 1769 return ip6_pkt_discard(skb);
1762} 1770}
1763 1771
1772#ifdef CONFIG_IPV6_MULTIPLE_TABLES
1773
1774static int ip6_pkt_prohibit(struct sk_buff *skb)
1775{
1776 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED);
1777}
1778
1779static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1780{
1781 skb->dev = skb->dst->dev;
1782 return ip6_pkt_prohibit(skb);
1783}
1784
1785static int ip6_pkt_blk_hole(struct sk_buff *skb)
1786{
1787 kfree_skb(skb);
1788 return 0;
1789}
1790
1791#endif
1792
1764/* 1793/*
1765 * Allocate a dst for local (unicast / anycast) address. 1794 * Allocate a dst for local (unicast / anycast) address.
1766 */ 1795 */
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 73cee2ec07e8..d400f8fae129 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -25,12 +25,14 @@
25static struct dst_ops xfrm6_dst_ops; 25static struct dst_ops xfrm6_dst_ops;
26static struct xfrm_policy_afinfo xfrm6_policy_afinfo; 26static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
27 27
28static int xfrm6_dst_lookup(struct xfrm_dst **dst, struct flowi *fl) 28static int xfrm6_dst_lookup(struct xfrm_dst **xdst, struct flowi *fl)
29{ 29{
30 int err = 0; 30 struct dst_entry *dst = ip6_route_output(NULL, fl);
31 *dst = (struct xfrm_dst*)ip6_route_output(NULL, fl); 31 int err = dst->error;
32 if (!*dst) 32 if (!err)
33 err = -ENETUNREACH; 33 *xdst = (struct xfrm_dst *) dst;
34 else
35 dst_release(dst);
34 return err; 36 return err;
35} 37}
36 38
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 249e5033c1a8..78071c6e6cf1 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -215,17 +215,17 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
215 } 215 }
216 216
217 dst = ip6_route_output(NULL, &fl); 217 dst = ip6_route_output(NULL, &fl);
218 if (dst) { 218 if (!dst->error) {
219 struct rt6_info *rt; 219 struct rt6_info *rt;
220 rt = (struct rt6_info *)dst; 220 rt = (struct rt6_info *)dst;
221 SCTP_DEBUG_PRINTK( 221 SCTP_DEBUG_PRINTK(
222 "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n", 222 "rt6_dst:" NIP6_FMT " rt6_src:" NIP6_FMT "\n",
223 NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr)); 223 NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
224 } else { 224 return dst;
225 SCTP_DEBUG_PRINTK("NO ROUTE\n");
226 } 225 }
227 226 SCTP_DEBUG_PRINTK("NO ROUTE\n");
228 return dst; 227 dst_release(dst);
228 return NULL;
229} 229}
230 230
231/* Returns the number of consecutive initial bits that match in the 2 ipv6 231/* Returns the number of consecutive initial bits that match in the 2 ipv6
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9deec4391187..9f34dec6ff8e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -821,7 +821,7 @@ out:
821 * addrs is a pointer to an array of one or more socket addresses. Each 821 * addrs is a pointer to an array of one or more socket addresses. Each
822 * address is contained in its appropriate structure (i.e. struct 822 * address is contained in its appropriate structure (i.e. struct
823 * sockaddr_in or struct sockaddr_in6) the family of the address type 823 * sockaddr_in or struct sockaddr_in6) the family of the address type
824 * must be used to distengish the address length (note that this 824 * must be used to distinguish the address length (note that this
825 * representation is termed a "packed array" of addresses). The caller 825 * representation is termed a "packed array" of addresses). The caller
826 * specifies the number of addresses in the array with addrcnt. 826 * specifies the number of addresses in the array with addrcnt.
827 * 827 *
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
index 919d5ba7ca0a..e52afab413de 100644
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -101,11 +101,13 @@ void rpc_getport(struct rpc_task *task)
101 /* Autobind on cloned rpc clients is discouraged */ 101 /* Autobind on cloned rpc clients is discouraged */
102 BUG_ON(clnt->cl_parent != clnt); 102 BUG_ON(clnt->cl_parent != clnt);
103 103
104 if (xprt_test_and_set_binding(xprt)) { 104 /* Put self on queue before sending rpcbind request, in case
105 task->tk_status = -EACCES; /* tell caller to check again */ 105 * pmap_getport_done completes before we return from rpc_run_task */
106 rpc_sleep_on(&xprt->binding, task, NULL, NULL); 106 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
107 return; 107
108 } 108 status = -EACCES; /* tell caller to check again */
109 if (xprt_test_and_set_binding(xprt))
110 goto bailout_nofree;
109 111
110 /* Someone else may have bound if we slept */ 112 /* Someone else may have bound if we slept */
111 status = 0; 113 status = 0;
@@ -134,8 +136,6 @@ void rpc_getport(struct rpc_task *task)
134 goto bailout; 136 goto bailout;
135 rpc_release_task(child); 137 rpc_release_task(child);
136 138
137 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
138
139 task->tk_xprt->stat.bind_count++; 139 task->tk_xprt->stat.bind_count++;
140 return; 140 return;
141 141
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 61e307cca13d..96521f16342b 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -973,7 +973,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
973 return 0; 973 return 0;
974 } 974 }
975 975
976 if (test_bit(SK_CONN, &svsk->sk_flags)) { 976 if (svsk->sk_sk->sk_state == TCP_LISTEN) {
977 svc_tcp_accept(svsk); 977 svc_tcp_accept(svsk);
978 svc_sock_received(svsk); 978 svc_sock_received(svsk);
979 return 0; 979 return 0;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 28100e019225..757fc91ef25d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1366,7 +1366,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1366 if (xprt->slot == NULL) 1366 if (xprt->slot == NULL)
1367 return -ENOMEM; 1367 return -ENOMEM;
1368 1368
1369 if (ntohs(addr->sin_port != 0)) 1369 if (ntohs(addr->sin_port) != 0)
1370 xprt_set_bound(xprt); 1370 xprt_set_bound(xprt);
1371 xprt->port = xs_get_random_port(); 1371 xprt->port = xs_get_random_port();
1372 1372
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 75a5968c2139..39744a33bd36 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -2,7 +2,7 @@
2 * net/tipc/bearer.c: TIPC bearer code 2 * net/tipc/bearer.c: TIPC bearer code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -191,14 +191,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
191 if ((i < media_count) && (m_ptr->addr2str != NULL)) { 191 if ((i < media_count) && (m_ptr->addr2str != NULL)) {
192 char addr_str[MAX_ADDR_STR]; 192 char addr_str[MAX_ADDR_STR];
193 193
194 tipc_printf(pb, "%s(%s) ", m_ptr->name, 194 tipc_printf(pb, "%s(%s)", m_ptr->name,
195 m_ptr->addr2str(a, addr_str, sizeof(addr_str))); 195 m_ptr->addr2str(a, addr_str, sizeof(addr_str)));
196 } else { 196 } else {
197 unchar *addr = (unchar *)&a->dev_addr; 197 unchar *addr = (unchar *)&a->dev_addr;
198 198
199 tipc_printf(pb, "UNKNOWN(%u):", media_type); 199 tipc_printf(pb, "UNKNOWN(%u)", media_type);
200 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) { 200 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) {
201 tipc_printf(pb, "%02x ", addr[i]); 201 tipc_printf(pb, "-%02x", addr[i]);
202 } 202 }
203 } 203 }
204} 204}
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 285e1bc2d880..ed1351ed05e1 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -2,7 +2,7 @@
2 * net/tipc/config.c: TIPC configuration management code 2 * net/tipc/config.c: TIPC configuration management code
3 * 3 *
4 * Copyright (c) 2002-2006, Ericsson AB 4 * Copyright (c) 2002-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -613,7 +613,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
613 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); 613 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id);
614 break; 614 break;
615 default: 615 default:
616 rep_tlv_buf = NULL; 616 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
617 " (unknown command)");
617 break; 618 break;
618 } 619 }
619 620
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 0539a8362858..6f5b7ee31180 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -57,7 +57,7 @@ void tipc_socket_stop(void);
57int tipc_netlink_start(void); 57int tipc_netlink_start(void);
58void tipc_netlink_stop(void); 58void tipc_netlink_stop(void);
59 59
60#define TIPC_MOD_VER "1.6.1" 60#define TIPC_MOD_VER "1.6.2"
61 61
62#ifndef CONFIG_TIPC_ZONES 62#ifndef CONFIG_TIPC_ZONES
63#define CONFIG_TIPC_ZONES 3 63#define CONFIG_TIPC_ZONES 3
@@ -90,7 +90,7 @@ int tipc_random;
90atomic_t tipc_user_count = ATOMIC_INIT(0); 90atomic_t tipc_user_count = ATOMIC_INIT(0);
91 91
92const char tipc_alphabet[] = 92const char tipc_alphabet[] =
93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; 93 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
94 94
95/* configurable TIPC parameters */ 95/* configurable TIPC parameters */
96 96
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 762aac2572be..4638947c2326 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -65,7 +65,7 @@
65#define assert(i) BUG_ON(!(i)) 65#define assert(i) BUG_ON(!(i))
66 66
67struct tipc_msg; 67struct tipc_msg;
68extern struct print_buf *TIPC_CONS, *TIPC_LOG; 68extern struct print_buf *TIPC_NULL, *TIPC_CONS, *TIPC_LOG;
69extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *); 69extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *);
70void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); 70void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
71void tipc_printf(struct print_buf *, const char *fmt, ...); 71void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -83,9 +83,9 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
83#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg) 83#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg)
84#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) 84#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
85 85
86#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) 86#define dbg(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
87#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0) 87#define msg_dbg(msg, txt) do {if (DBG_OUTPUT != TIPC_NULL) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
88#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) 88#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
89 89
90 90
91/* 91/*
@@ -94,11 +94,11 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
94 * here, or on a per .c file basis, by redefining these symbols. The following 94 * here, or on a per .c file basis, by redefining these symbols. The following
95 * print buffer options are available: 95 * print buffer options are available:
96 * 96 *
97 * NULL : Output to null print buffer (i.e. print nowhere) 97 * TIPC_NULL : null buffer (i.e. print nowhere)
98 * TIPC_CONS : Output to system console 98 * TIPC_CONS : system console
99 * TIPC_LOG : Output to TIPC log buffer 99 * TIPC_LOG : TIPC log buffer
100 * &buf : Output to user-defined buffer (struct print_buf *) 100 * &buf : user-defined buffer (struct print_buf *)
101 * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) ) 101 * TIPC_TEE(&buf_a,&buf_b) : list of buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG))
102 */ 102 */
103 103
104#ifndef TIPC_OUTPUT 104#ifndef TIPC_OUTPUT
@@ -106,7 +106,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
106#endif 106#endif
107 107
108#ifndef DBG_OUTPUT 108#ifndef DBG_OUTPUT
109#define DBG_OUTPUT NULL 109#define DBG_OUTPUT TIPC_NULL
110#endif 110#endif
111 111
112#else 112#else
@@ -136,7 +136,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
136#define TIPC_OUTPUT TIPC_CONS 136#define TIPC_OUTPUT TIPC_CONS
137 137
138#undef DBG_OUTPUT 138#undef DBG_OUTPUT
139#define DBG_OUTPUT NULL 139#define DBG_OUTPUT TIPC_NULL
140 140
141#endif 141#endif
142 142
@@ -275,11 +275,15 @@ static inline void k_term_timer(struct timer_list *timer)
275/* 275/*
276 * TIPC message buffer code 276 * TIPC message buffer code
277 * 277 *
278 * TIPC message buffer headroom leaves room for 14 byte Ethernet header, 278 * TIPC message buffer headroom reserves space for a link-level header
279 * (in case the message is sent off-node),
279 * while ensuring TIPC header is word aligned for quicker access 280 * while ensuring TIPC header is word aligned for quicker access
281 *
282 * The largest header currently supported is 18 bytes, which is used when
283 * the standard 14 byte Ethernet header has 4 added bytes for VLAN info
280 */ 284 */
281 285
282#define BUF_HEADROOM 16u 286#define BUF_HEADROOM 20u
283 287
284struct tipc_skb_cb { 288struct tipc_skb_cb {
285 void *handle; 289 void *handle;
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 55130655e1ed..d8af4c28695d 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * net/tipc/dbg.c: TIPC print buffer routines for debuggign 2 * net/tipc/dbg.c: TIPC print buffer routines for debugging
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -38,11 +38,12 @@
38#include "config.h" 38#include "config.h"
39#include "dbg.h" 39#include "dbg.h"
40 40
41#define MAX_STRING 512 41static char print_string[TIPC_PB_MAX_STR];
42
43static char print_string[MAX_STRING];
44static DEFINE_SPINLOCK(print_lock); 42static DEFINE_SPINLOCK(print_lock);
45 43
44static struct print_buf null_buf = { NULL, 0, NULL, NULL };
45struct print_buf *TIPC_NULL = &null_buf;
46
46static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; 47static struct print_buf cons_buf = { NULL, 0, NULL, NULL };
47struct print_buf *TIPC_CONS = &cons_buf; 48struct print_buf *TIPC_CONS = &cons_buf;
48 49
@@ -62,68 +63,83 @@ struct print_buf *TIPC_LOG = &log_buf;
62/* 63/*
63 * Locking policy when using print buffers. 64 * Locking policy when using print buffers.
64 * 65 *
65 * 1) Routines of the form printbuf_XXX() rely on the caller to prevent 66 * The following routines use 'print_lock' for protection:
66 * simultaneous use of the print buffer(s) being manipulated. 67 * 1) tipc_printf() - to protect its print buffer(s) and 'print_string'
67 * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of 68 * 2) TIPC_TEE() - to protect its print buffer(s)
68 * 'print_string' and to protect its print buffer(s). 69 * 3) tipc_dump() - to protect its print buffer(s) and 'print_string'
69 * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s). 70 * 4) tipc_log_XXX() - to protect TIPC_LOG
70 * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG. 71 *
72 * All routines of the form tipc_printbuf_XXX() rely on the caller to prevent
73 * simultaneous use of the print buffer(s) being manipulated.
71 */ 74 */
72 75
73/** 76/**
74 * tipc_printbuf_init - initialize print buffer to empty 77 * tipc_printbuf_init - initialize print buffer to empty
78 * @pb: pointer to print buffer structure
79 * @raw: pointer to character array used by print buffer
80 * @size: size of character array
81 *
82 * Makes the print buffer a null device that discards anything written to it
83 * if the character array is too small (or absent).
75 */ 84 */
76 85
77void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz) 86void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
78{ 87{
79 if (!pb || !raw || (sz < (MAX_STRING + 1))) 88 pb->buf = raw;
80 return; 89 pb->crs = raw;
81 90 pb->size = size;
82 pb->crs = pb->buf = raw;
83 pb->size = sz;
84 pb->next = NULL; 91 pb->next = NULL;
85 pb->buf[0] = 0; 92
86 pb->buf[sz-1] = ~0; 93 if (size < TIPC_PB_MIN_SIZE) {
94 pb->buf = NULL;
95 } else if (raw) {
96 pb->buf[0] = 0;
97 pb->buf[size-1] = ~0;
98 }
87} 99}
88 100
89/** 101/**
90 * tipc_printbuf_reset - reinitialize print buffer to empty state 102 * tipc_printbuf_reset - reinitialize print buffer to empty state
103 * @pb: pointer to print buffer structure
91 */ 104 */
92 105
93void tipc_printbuf_reset(struct print_buf *pb) 106void tipc_printbuf_reset(struct print_buf *pb)
94{ 107{
95 if (pb && pb->buf) 108 tipc_printbuf_init(pb, pb->buf, pb->size);
96 tipc_printbuf_init(pb, pb->buf, pb->size);
97} 109}
98 110
99/** 111/**
100 * tipc_printbuf_empty - test if print buffer is in empty state 112 * tipc_printbuf_empty - test if print buffer is in empty state
113 * @pb: pointer to print buffer structure
114 *
115 * Returns non-zero if print buffer is empty.
101 */ 116 */
102 117
103int tipc_printbuf_empty(struct print_buf *pb) 118int tipc_printbuf_empty(struct print_buf *pb)
104{ 119{
105 return (!pb || !pb->buf || (pb->crs == pb->buf)); 120 return (!pb->buf || (pb->crs == pb->buf));
106} 121}
107 122
108/** 123/**
109 * tipc_printbuf_validate - check for print buffer overflow 124 * tipc_printbuf_validate - check for print buffer overflow
125 * @pb: pointer to print buffer structure
110 * 126 *
111 * Verifies that a print buffer has captured all data written to it. 127 * Verifies that a print buffer has captured all data written to it.
112 * If data has been lost, linearize buffer and prepend an error message 128 * If data has been lost, linearize buffer and prepend an error message
113 * 129 *
114 * Returns length of print buffer data string (including trailing NULL) 130 * Returns length of print buffer data string (including trailing NUL)
115 */ 131 */
116 132
117int tipc_printbuf_validate(struct print_buf *pb) 133int tipc_printbuf_validate(struct print_buf *pb)
118{ 134{
119 char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; 135 char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
120 char *cp_buf; 136 char *cp_buf;
121 struct print_buf cb; 137 struct print_buf cb;
122 138
123 if (!pb || !pb->buf) 139 if (!pb->buf)
124 return 0; 140 return 0;
125 141
126 if (pb->buf[pb->size - 1] == '\0') { 142 if (pb->buf[pb->size - 1] == 0) {
127 cp_buf = kmalloc(pb->size, GFP_ATOMIC); 143 cp_buf = kmalloc(pb->size, GFP_ATOMIC);
128 if (cp_buf != NULL){ 144 if (cp_buf != NULL){
129 tipc_printbuf_init(&cb, cp_buf, pb->size); 145 tipc_printbuf_init(&cb, cp_buf, pb->size);
@@ -141,6 +157,8 @@ int tipc_printbuf_validate(struct print_buf *pb)
141 157
142/** 158/**
143 * tipc_printbuf_move - move print buffer contents to another print buffer 159 * tipc_printbuf_move - move print buffer contents to another print buffer
160 * @pb_to: pointer to destination print buffer structure
161 * @pb_from: pointer to source print buffer structure
144 * 162 *
145 * Current contents of destination print buffer (if any) are discarded. 163 * Current contents of destination print buffer (if any) are discarded.
146 * Source print buffer becomes empty if a successful move occurs. 164 * Source print buffer becomes empty if a successful move occurs.
@@ -152,21 +170,22 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
152 170
153 /* Handle the cases where contents can't be moved */ 171 /* Handle the cases where contents can't be moved */
154 172
155 if (!pb_to || !pb_to->buf) 173 if (!pb_to->buf)
156 return; 174 return;
157 175
158 if (!pb_from || !pb_from->buf) { 176 if (!pb_from->buf) {
159 tipc_printbuf_reset(pb_to); 177 tipc_printbuf_reset(pb_to);
160 return; 178 return;
161 } 179 }
162 180
163 if (pb_to->size < pb_from->size) { 181 if (pb_to->size < pb_from->size) {
164 tipc_printbuf_reset(pb_to); 182 tipc_printbuf_reset(pb_to);
165 tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); 183 tipc_printf(pb_to, "*** PRINT BUFFER MOVE ERROR ***");
166 return; 184 return;
167 } 185 }
168 186
169 /* Copy data from char after cursor to end (if used) */ 187 /* Copy data from char after cursor to end (if used) */
188
170 len = pb_from->buf + pb_from->size - pb_from->crs - 2; 189 len = pb_from->buf + pb_from->size - pb_from->crs - 2;
171 if ((pb_from->buf[pb_from->size-1] == 0) && (len > 0)) { 190 if ((pb_from->buf[pb_from->size-1] == 0) && (len > 0)) {
172 strcpy(pb_to->buf, pb_from->crs + 1); 191 strcpy(pb_to->buf, pb_from->crs + 1);
@@ -175,6 +194,7 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
175 pb_to->crs = pb_to->buf; 194 pb_to->crs = pb_to->buf;
176 195
177 /* Copy data from start to cursor (always) */ 196 /* Copy data from start to cursor (always) */
197
178 len = pb_from->crs - pb_from->buf; 198 len = pb_from->crs - pb_from->buf;
179 strcpy(pb_to->crs, pb_from->buf); 199 strcpy(pb_to->crs, pb_from->buf);
180 pb_to->crs += len; 200 pb_to->crs += len;
@@ -184,6 +204,8 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
184 204
185/** 205/**
186 * tipc_printf - append formatted output to print buffer chain 206 * tipc_printf - append formatted output to print buffer chain
207 * @pb: pointer to chain of print buffers (may be NULL)
208 * @fmt: formatted info to be printed
187 */ 209 */
188 210
189void tipc_printf(struct print_buf *pb, const char *fmt, ...) 211void tipc_printf(struct print_buf *pb, const char *fmt, ...)
@@ -195,8 +217,8 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
195 217
196 spin_lock_bh(&print_lock); 218 spin_lock_bh(&print_lock);
197 FORMAT(print_string, chars_to_add, fmt); 219 FORMAT(print_string, chars_to_add, fmt);
198 if (chars_to_add >= MAX_STRING) 220 if (chars_to_add >= TIPC_PB_MAX_STR)
199 strcpy(print_string, "*** STRING TOO LONG ***"); 221 strcpy(print_string, "*** PRINT BUFFER STRING TOO LONG ***");
200 222
201 while (pb) { 223 while (pb) {
202 if (pb == TIPC_CONS) 224 if (pb == TIPC_CONS)
@@ -206,6 +228,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
206 if (chars_to_add <= chars_left) { 228 if (chars_to_add <= chars_left) {
207 strcpy(pb->crs, print_string); 229 strcpy(pb->crs, print_string);
208 pb->crs += chars_to_add; 230 pb->crs += chars_to_add;
231 } else if (chars_to_add >= (pb->size - 1)) {
232 strcpy(pb->buf, print_string + chars_to_add + 1
233 - pb->size);
234 pb->crs = pb->buf + pb->size - 1;
209 } else { 235 } else {
210 strcpy(pb->buf, print_string + chars_left); 236 strcpy(pb->buf, print_string + chars_left);
211 save_char = print_string[chars_left]; 237 save_char = print_string[chars_left];
@@ -224,6 +250,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
224 250
225/** 251/**
226 * TIPC_TEE - perform next output operation on both print buffers 252 * TIPC_TEE - perform next output operation on both print buffers
253 * @b0: pointer to chain of print buffers (may be NULL)
254 * @b1: pointer to print buffer to add to chain
255 *
256 * Returns pointer to print buffer chain.
227 */ 257 */
228 258
229struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1) 259struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
@@ -232,8 +262,6 @@ struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
232 262
233 if (!b0 || (b0 == b1)) 263 if (!b0 || (b0 == b1))
234 return b1; 264 return b1;
235 if (!b1)
236 return b0;
237 265
238 spin_lock_bh(&print_lock); 266 spin_lock_bh(&print_lock);
239 while (pb->next) { 267 while (pb->next) {
@@ -256,7 +284,7 @@ static void print_to_console(char *crs, int len)
256 int rest = len; 284 int rest = len;
257 285
258 while (rest > 0) { 286 while (rest > 0) {
259 int sz = rest < MAX_STRING ? rest : MAX_STRING; 287 int sz = rest < TIPC_PB_MAX_STR ? rest : TIPC_PB_MAX_STR;
260 char c = crs[sz]; 288 char c = crs[sz];
261 289
262 crs[sz] = 0; 290 crs[sz] = 0;
@@ -275,36 +303,48 @@ static void printbuf_dump(struct print_buf *pb)
275{ 303{
276 int len; 304 int len;
277 305
306 if (!pb->buf) {
307 printk("*** PRINT BUFFER NOT ALLOCATED ***");
308 return;
309 }
310
278 /* Dump print buffer from char after cursor to end (if used) */ 311 /* Dump print buffer from char after cursor to end (if used) */
312
279 len = pb->buf + pb->size - pb->crs - 2; 313 len = pb->buf + pb->size - pb->crs - 2;
280 if ((pb->buf[pb->size - 1] == 0) && (len > 0)) 314 if ((pb->buf[pb->size - 1] == 0) && (len > 0))
281 print_to_console(pb->crs + 1, len); 315 print_to_console(pb->crs + 1, len);
282 316
283 /* Dump print buffer from start to cursor (always) */ 317 /* Dump print buffer from start to cursor (always) */
318
284 len = pb->crs - pb->buf; 319 len = pb->crs - pb->buf;
285 print_to_console(pb->buf, len); 320 print_to_console(pb->buf, len);
286} 321}
287 322
288/** 323/**
289 * tipc_dump - dump non-console print buffer(s) to console 324 * tipc_dump - dump non-console print buffer(s) to console
325 * @pb: pointer to chain of print buffers
290 */ 326 */
291 327
292void tipc_dump(struct print_buf *pb, const char *fmt, ...) 328void tipc_dump(struct print_buf *pb, const char *fmt, ...)
293{ 329{
330 struct print_buf *pb_next;
294 int len; 331 int len;
295 332
296 spin_lock_bh(&print_lock); 333 spin_lock_bh(&print_lock);
297 FORMAT(TIPC_CONS->buf, len, fmt); 334 FORMAT(print_string, len, fmt);
298 printk(TIPC_CONS->buf); 335 printk(print_string);
299 336
300 for (; pb; pb = pb->next) { 337 for (; pb; pb = pb->next) {
301 if (pb == TIPC_CONS) 338 if (pb != TIPC_CONS) {
302 continue; 339 printk("\n---- Start of %s log dump ----\n\n",
303 printk("\n---- Start of dump,%s log ----\n\n", 340 (pb == TIPC_LOG) ? "global" : "local");
304 (pb == TIPC_LOG) ? "global" : "local"); 341 printbuf_dump(pb);
305 printbuf_dump(pb); 342 tipc_printbuf_reset(pb);
306 tipc_printbuf_reset(pb); 343 printk("\n---- End of dump ----\n");
307 printk("\n-------- End of dump --------\n"); 344 }
345 pb_next = pb->next;
346 pb->next = NULL;
347 pb = pb_next;
308 } 348 }
309 spin_unlock_bh(&print_lock); 349 spin_unlock_bh(&print_lock);
310} 350}
@@ -324,7 +364,8 @@ void tipc_log_stop(void)
324} 364}
325 365
326/** 366/**
327 * tipc_log_reinit - set TIPC log print buffer to specified size 367 * tipc_log_reinit - (re)initialize TIPC log print buffer
368 * @log_size: print buffer size to use
328 */ 369 */
329 370
330void tipc_log_reinit(int log_size) 371void tipc_log_reinit(int log_size)
@@ -332,10 +373,11 @@ void tipc_log_reinit(int log_size)
332 tipc_log_stop(); 373 tipc_log_stop();
333 374
334 if (log_size) { 375 if (log_size) {
335 if (log_size <= MAX_STRING) 376 if (log_size < TIPC_PB_MIN_SIZE)
336 log_size = MAX_STRING + 1; 377 log_size = TIPC_PB_MIN_SIZE;
337 spin_lock_bh(&print_lock); 378 spin_lock_bh(&print_lock);
338 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size); 379 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC),
380 log_size);
339 spin_unlock_bh(&print_lock); 381 spin_unlock_bh(&print_lock);
340 } 382 }
341} 383}
diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h
index 227f050d2a52..467c0bc78a79 100644
--- a/net/tipc/dbg.h
+++ b/net/tipc/dbg.h
@@ -2,7 +2,7 @@
2 * net/tipc/dbg.h: Include file for TIPC print buffer routines 2 * net/tipc/dbg.h: Include file for TIPC print buffer routines
3 * 3 *
4 * Copyright (c) 1997-2006, Ericsson AB 4 * Copyright (c) 1997-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,14 @@
37#ifndef _TIPC_DBG_H 37#ifndef _TIPC_DBG_H
38#define _TIPC_DBG_H 38#define _TIPC_DBG_H
39 39
40/**
41 * struct print_buf - TIPC print buffer structure
42 * @buf: pointer to character array containing print buffer contents
43 * @size: size of character array
44 * @crs: pointer to first unused space in character array (i.e. final NUL)
45 * @next: used to link print buffers when printing to more than one at a time
46 */
47
40struct print_buf { 48struct print_buf {
41 char *buf; 49 char *buf;
42 u32 size; 50 u32 size;
@@ -44,7 +52,10 @@ struct print_buf {
44 struct print_buf *next; 52 struct print_buf *next;
45}; 53};
46 54
47void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz); 55#define TIPC_PB_MIN_SIZE 64 /* minimum size for a print buffer's array */
56#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
57
58void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
48void tipc_printbuf_reset(struct print_buf *pb); 59void tipc_printbuf_reset(struct print_buf *pb);
49int tipc_printbuf_empty(struct print_buf *pb); 60int tipc_printbuf_empty(struct print_buf *pb);
50int tipc_printbuf_validate(struct print_buf *pb); 61int tipc_printbuf_validate(struct print_buf *pb);
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index ee94de92ae99..3b0cd12f37da 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -132,6 +132,28 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
132} 132}
133 133
134/** 134/**
135 * disc_dupl_alert - issue node address duplication alert
136 * @b_ptr: pointer to bearer detecting duplication
137 * @node_addr: duplicated node address
138 * @media_addr: media address advertised by duplicated node
139 */
140
141static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr,
142 struct tipc_media_addr *media_addr)
143{
144 char node_addr_str[16];
145 char media_addr_str[64];
146 struct print_buf pb;
147
148 addr_string_fill(node_addr_str, node_addr);
149 tipc_printbuf_init(&pb, media_addr_str, sizeof(media_addr_str));
150 tipc_media_addr_printf(&pb, media_addr);
151 tipc_printbuf_validate(&pb);
152 warn("Duplicate %s using %s seen on <%s>\n",
153 node_addr_str, media_addr_str, b_ptr->publ.name);
154}
155
156/**
135 * tipc_disc_recv_msg - handle incoming link setup message (request or response) 157 * tipc_disc_recv_msg - handle incoming link setup message (request or response)
136 * @buf: buffer containing message 158 * @buf: buffer containing message
137 */ 159 */
@@ -157,8 +179,11 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
157 return; 179 return;
158 if (!tipc_addr_node_valid(orig)) 180 if (!tipc_addr_node_valid(orig))
159 return; 181 return;
160 if (orig == tipc_own_addr) 182 if (orig == tipc_own_addr) {
183 if (memcmp(&media_addr, &b_ptr->publ.addr, sizeof(media_addr)))
184 disc_dupl_alert(b_ptr, tipc_own_addr, &media_addr);
161 return; 185 return;
186 }
162 if (!in_scope(dest, tipc_own_addr)) 187 if (!in_scope(dest, tipc_own_addr))
163 return; 188 return;
164 if (is_slave(tipc_own_addr) && is_slave(orig)) 189 if (is_slave(tipc_own_addr) && is_slave(orig))
@@ -170,7 +195,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
170 struct sk_buff *rbuf; 195 struct sk_buff *rbuf;
171 struct tipc_media_addr *addr; 196 struct tipc_media_addr *addr;
172 struct node *n_ptr = tipc_node_find(orig); 197 struct node *n_ptr = tipc_node_find(orig);
173 int link_up; 198 int link_fully_up;
199
174 dbg(" in own cluster\n"); 200 dbg(" in own cluster\n");
175 if (n_ptr == NULL) { 201 if (n_ptr == NULL) {
176 n_ptr = tipc_node_create(orig); 202 n_ptr = tipc_node_create(orig);
@@ -190,14 +216,19 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
190 } 216 }
191 addr = &link->media_addr; 217 addr = &link->media_addr;
192 if (memcmp(addr, &media_addr, sizeof(*addr))) { 218 if (memcmp(addr, &media_addr, sizeof(*addr))) {
219 if (tipc_link_is_up(link) || (!link->started)) {
220 disc_dupl_alert(b_ptr, orig, &media_addr);
221 spin_unlock_bh(&n_ptr->lock);
222 return;
223 }
193 warn("Resetting link <%s>, peer interface address changed\n", 224 warn("Resetting link <%s>, peer interface address changed\n",
194 link->name); 225 link->name);
195 memcpy(addr, &media_addr, sizeof(*addr)); 226 memcpy(addr, &media_addr, sizeof(*addr));
196 tipc_link_reset(link); 227 tipc_link_reset(link);
197 } 228 }
198 link_up = tipc_link_is_up(link); 229 link_fully_up = (link->state == WORKING_WORKING);
199 spin_unlock_bh(&n_ptr->lock); 230 spin_unlock_bh(&n_ptr->lock);
200 if ((type == DSC_RESP_MSG) || link_up) 231 if ((type == DSC_RESP_MSG) || link_fully_up)
201 return; 232 return;
202 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); 233 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
203 if (rbuf != NULL) { 234 if (rbuf != NULL) {
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 53bc8cb5adbc..1bb983c8130b 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -132,7 +132,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
132 * allow the output from multiple links to be intermixed. For this reason 132 * allow the output from multiple links to be intermixed. For this reason
133 * routines of the form "dbg_link_XXX()" have been created that will capture 133 * routines of the form "dbg_link_XXX()" have been created that will capture
134 * debug info into a link's personal print buffer, which can then be dumped 134 * debug info into a link's personal print buffer, which can then be dumped
135 * into the TIPC system log (LOG) upon request. 135 * into the TIPC system log (TIPC_LOG) upon request.
136 * 136 *
137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size 137 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size
138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, 138 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0,
@@ -141,7 +141,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
141 * when there is only a single link in the system being debugged. 141 * when there is only a single link in the system being debugged.
142 * 142 *
143 * Notes: 143 * Notes:
144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least 1000 (bytes) 144 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE
145 * - "l_ptr" must be valid when using dbg_link_XXX() macros 145 * - "l_ptr" must be valid when using dbg_link_XXX() macros
146 */ 146 */
147 147
@@ -159,13 +159,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
159 159
160static void dbg_print_link(struct link *l_ptr, const char *str) 160static void dbg_print_link(struct link *l_ptr, const char *str)
161{ 161{
162 if (DBG_OUTPUT) 162 if (DBG_OUTPUT != TIPC_NULL)
163 link_print(l_ptr, DBG_OUTPUT, str); 163 link_print(l_ptr, DBG_OUTPUT, str);
164} 164}
165 165
166static void dbg_print_buf_chain(struct sk_buff *root_buf) 166static void dbg_print_buf_chain(struct sk_buff *root_buf)
167{ 167{
168 if (DBG_OUTPUT) { 168 if (DBG_OUTPUT != TIPC_NULL) {
169 struct sk_buff *buf = root_buf; 169 struct sk_buff *buf = root_buf;
170 170
171 while (buf) { 171 while (buf) {
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index f0b063bcc2a9..03bd659c43ca 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -122,7 +122,7 @@ void tipc_named_publish(struct publication *publ)
122 struct sk_buff *buf; 122 struct sk_buff *buf;
123 struct distr_item *item; 123 struct distr_item *item;
124 124
125 list_add(&publ->local_list, &publ_root); 125 list_add_tail(&publ->local_list, &publ_root);
126 publ_cnt++; 126 publ_cnt++;
127 127
128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); 128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index fc6d09630ccd..886bda5e88db 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -648,7 +648,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
649 " (network address)"); 649 " (network address)");
650 650
651 if (!tipc_nodes) 651 if (tipc_mode != TIPC_NET_MODE)
652 return tipc_cfg_reply_none(); 652 return tipc_cfg_reply_none();
653 653
654 /* Get space for all unicast links + multicast link */ 654 /* Get space for all unicast links + multicast link */
diff --git a/net/tipc/port.c b/net/tipc/port.c
index b9c8c6b9e94f..c1a1a76759b5 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -505,8 +505,13 @@ static void port_timeout(unsigned long ref)
505 struct port *p_ptr = tipc_port_lock(ref); 505 struct port *p_ptr = tipc_port_lock(ref);
506 struct sk_buff *buf = NULL; 506 struct sk_buff *buf = NULL;
507 507
508 if (!p_ptr || !p_ptr->publ.connected) 508 if (!p_ptr)
509 return;
510
511 if (!p_ptr->publ.connected) {
512 tipc_port_unlock(p_ptr);
509 return; 513 return;
514 }
510 515
511 /* Last probe answered ? */ 516 /* Last probe answered ? */
512 if (p_ptr->probing_state == PROBING) { 517 if (p_ptr->probing_state == PROBING) {
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index acfb852e7c98..2a6a5a6b4c12 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2,7 +2,7 @@
2 * net/tipc/socket.c: TIPC socket API 2 * net/tipc/socket.c: TIPC socket API
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -629,6 +629,9 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
629 return -ENOTCONN; 629 return -ENOTCONN;
630 } 630 }
631 631
632 if (unlikely(m->msg_name))
633 return -EISCONN;
634
632 /* 635 /*
633 * Send each iovec entry using one or more messages 636 * Send each iovec entry using one or more messages
634 * 637 *
@@ -641,6 +644,8 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
641 curr_iovlen = m->msg_iovlen; 644 curr_iovlen = m->msg_iovlen;
642 my_msg.msg_iov = &my_iov; 645 my_msg.msg_iov = &my_iov;
643 my_msg.msg_iovlen = 1; 646 my_msg.msg_iovlen = 1;
647 my_msg.msg_flags = m->msg_flags;
648 my_msg.msg_name = NULL;
644 bytes_sent = 0; 649 bytes_sent = 0;
645 650
646 while (curr_iovlen--) { 651 while (curr_iovlen--) {
@@ -1203,7 +1208,8 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1203 atomic_inc(&tipc_queue_size); 1208 atomic_inc(&tipc_queue_size);
1204 skb_queue_tail(&sock->sk->sk_receive_queue, buf); 1209 skb_queue_tail(&sock->sk->sk_receive_queue, buf);
1205 1210
1206 wake_up_interruptible(sock->sk->sk_sleep); 1211 if (waitqueue_active(sock->sk->sk_sleep))
1212 wake_up_interruptible(sock->sk->sk_sleep);
1207 return TIPC_OK; 1213 return TIPC_OK;
1208} 1214}
1209 1215
@@ -1218,7 +1224,8 @@ static void wakeupdispatch(struct tipc_port *tport)
1218{ 1224{
1219 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle; 1225 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle;
1220 1226
1221 wake_up_interruptible(tsock->sk.sk_sleep); 1227 if (waitqueue_active(tsock->sk.sk_sleep))
1228 wake_up_interruptible(tsock->sk.sk_sleep);
1222} 1229}
1223 1230
1224/** 1231/**
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index c51600ba5f4a..7a918f12a5df 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -155,7 +155,7 @@ void tipc_subscr_report_overlap(struct subscription *sub,
155 sub->seq.upper, found_lower, found_upper); 155 sub->seq.upper, found_lower, found_upper);
156 if (!tipc_subscr_overlap(sub, found_lower, found_upper)) 156 if (!tipc_subscr_overlap(sub, found_lower, found_upper))
157 return; 157 return;
158 if (!must && (sub->filter != TIPC_SUB_PORTS)) 158 if (!must && !(sub->filter & TIPC_SUB_PORTS))
159 return; 159 return;
160 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); 160 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node);
161} 161}
@@ -176,6 +176,13 @@ static void subscr_timeout(struct subscription *sub)
176 if (subscriber == NULL) 176 if (subscriber == NULL)
177 return; 177 return;
178 178
179 /* Validate timeout (in case subscription is being cancelled) */
180
181 if (sub->timeout == TIPC_WAIT_FOREVER) {
182 tipc_ref_unlock(subscriber_ref);
183 return;
184 }
185
179 /* Unlink subscription from name table */ 186 /* Unlink subscription from name table */
180 187
181 tipc_nametbl_unsubscribe(sub); 188 tipc_nametbl_unsubscribe(sub);
@@ -199,6 +206,20 @@ static void subscr_timeout(struct subscription *sub)
199} 206}
200 207
201/** 208/**
209 * subscr_del - delete a subscription within a subscription list
210 *
211 * Called with subscriber locked.
212 */
213
214static void subscr_del(struct subscription *sub)
215{
216 tipc_nametbl_unsubscribe(sub);
217 list_del(&sub->subscription_list);
218 kfree(sub);
219 atomic_dec(&topsrv.subscription_count);
220}
221
222/**
202 * subscr_terminate - terminate communication with a subscriber 223 * subscr_terminate - terminate communication with a subscriber
203 * 224 *
204 * Called with subscriber locked. Routine must temporarily release this lock 225 * Called with subscriber locked. Routine must temporarily release this lock
@@ -227,12 +248,9 @@ static void subscr_terminate(struct subscriber *subscriber)
227 k_cancel_timer(&sub->timer); 248 k_cancel_timer(&sub->timer);
228 k_term_timer(&sub->timer); 249 k_term_timer(&sub->timer);
229 } 250 }
230 tipc_nametbl_unsubscribe(sub); 251 dbg("Term: Removing sub %u,%u,%u from subscriber %x list\n",
231 list_del(&sub->subscription_list);
232 dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n",
233 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); 252 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
234 kfree(sub); 253 subscr_del(sub);
235 atomic_dec(&topsrv.subscription_count);
236 } 254 }
237 255
238 /* Sever connection to subscriber */ 256 /* Sever connection to subscriber */
@@ -253,6 +271,49 @@ static void subscr_terminate(struct subscriber *subscriber)
253} 271}
254 272
255/** 273/**
274 * subscr_cancel - handle subscription cancellation request
275 *
276 * Called with subscriber locked. Routine must temporarily release this lock
277 * to enable the subscription timeout routine to finish without deadlocking;
278 * the lock is then reclaimed to allow caller to release it upon return.
279 *
280 * Note that fields of 's' use subscriber's endianness!
281 */
282
283static void subscr_cancel(struct tipc_subscr *s,
284 struct subscriber *subscriber)
285{
286 struct subscription *sub;
287 struct subscription *sub_temp;
288 int found = 0;
289
290 /* Find first matching subscription, exit if not found */
291
292 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
293 subscription_list) {
294 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
295 found = 1;
296 break;
297 }
298 }
299 if (!found)
300 return;
301
302 /* Cancel subscription timer (if used), then delete subscription */
303
304 if (sub->timeout != TIPC_WAIT_FOREVER) {
305 sub->timeout = TIPC_WAIT_FOREVER;
306 spin_unlock_bh(subscriber->lock);
307 k_cancel_timer(&sub->timer);
308 k_term_timer(&sub->timer);
309 spin_lock_bh(subscriber->lock);
310 }
311 dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n",
312 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
313 subscr_del(sub);
314}
315
316/**
256 * subscr_subscribe - create subscription for subscriber 317 * subscr_subscribe - create subscription for subscriber
257 * 318 *
258 * Called with subscriber locked 319 * Called with subscriber locked
@@ -263,6 +324,21 @@ static void subscr_subscribe(struct tipc_subscr *s,
263{ 324{
264 struct subscription *sub; 325 struct subscription *sub;
265 326
327 /* Determine/update subscriber's endianness */
328
329 if (s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE))
330 subscriber->swap = 0;
331 else
332 subscriber->swap = 1;
333
334 /* Detect & process a subscription cancellation request */
335
336 if (s->filter & htohl(TIPC_SUB_CANCEL, subscriber->swap)) {
337 s->filter &= ~htohl(TIPC_SUB_CANCEL, subscriber->swap);
338 subscr_cancel(s, subscriber);
339 return;
340 }
341
266 /* Refuse subscription if global limit exceeded */ 342 /* Refuse subscription if global limit exceeded */
267 343
268 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { 344 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
@@ -281,13 +357,6 @@ static void subscr_subscribe(struct tipc_subscr *s,
281 return; 357 return;
282 } 358 }
283 359
284 /* Determine/update subscriber's endianness */
285
286 if ((s->filter == TIPC_SUB_PORTS) || (s->filter == TIPC_SUB_SERVICE))
287 subscriber->swap = 0;
288 else
289 subscriber->swap = 1;
290
291 /* Initialize subscription object */ 360 /* Initialize subscription object */
292 361
293 memset(sub, 0, sizeof(*sub)); 362 memset(sub, 0, sizeof(*sub));
@@ -296,8 +365,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
296 sub->seq.upper = htohl(s->seq.upper, subscriber->swap); 365 sub->seq.upper = htohl(s->seq.upper, subscriber->swap);
297 sub->timeout = htohl(s->timeout, subscriber->swap); 366 sub->timeout = htohl(s->timeout, subscriber->swap);
298 sub->filter = htohl(s->filter, subscriber->swap); 367 sub->filter = htohl(s->filter, subscriber->swap);
299 if ((((sub->filter != TIPC_SUB_PORTS) 368 if ((!(sub->filter & TIPC_SUB_PORTS)
300 && (sub->filter != TIPC_SUB_SERVICE))) 369 == !(sub->filter & TIPC_SUB_SERVICE))
301 || (sub->seq.lower > sub->seq.upper)) { 370 || (sub->seq.lower > sub->seq.upper)) {
302 warn("Subscription rejected, illegal request\n"); 371 warn("Subscription rejected, illegal request\n");
303 kfree(sub); 372 kfree(sub);