aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-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/configfs/file.c14
-rw-r--r--fs/dlm/lowcomms.c1
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/fat/file.c3
-rw-r--r--fs/gfs2/bmap.c13
-rw-r--r--fs/gfs2/bmap.h2
-rw-r--r--fs/gfs2/dir.c10
-rw-r--r--fs/gfs2/log.c6
-rw-r--r--fs/gfs2/ops_address.c6
-rw-r--r--fs/gfs2/ops_fstype.c7
-rw-r--r--fs/gfs2/quota.c5
-rw-r--r--fs/gfs2/recovery.c5
-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/ocfs2/cluster/nodemanager.c10
-rw-r--r--fs/ocfs2/file.c51
-rw-r--r--fs/ocfs2/namei.c8
-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
70 files changed, 1315 insertions, 1252 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index 6a3df055280..fee318e6f4b 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 c7700d9b3f9..906ba5ce226 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 3fded389d06..bf8c8af9800 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 aca12375240..cea5219b4f3 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 2c9759baad6..54c518c89e4 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/configfs/file.c b/fs/configfs/file.c
index e6d5754a715..cf33fac68c8 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -275,13 +275,14 @@ static int check_perm(struct inode * inode, struct file * file)
275 * it in file->private_data for easy access. 275 * it in file->private_data for easy access.
276 */ 276 */
277 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL); 277 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
278 if (buffer) { 278 if (!buffer) {
279 init_MUTEX(&buffer->sem);
280 buffer->needs_read_fill = 1;
281 buffer->ops = ops;
282 file->private_data = buffer;
283 } else
284 error = -ENOMEM; 279 error = -ENOMEM;
280 goto Enomem;
281 }
282 init_MUTEX(&buffer->sem);
283 buffer->needs_read_fill = 1;
284 buffer->ops = ops;
285 file->private_data = buffer;
285 goto Done; 286 goto Done;
286 287
287 Einval: 288 Einval:
@@ -289,6 +290,7 @@ static int check_perm(struct inode * inode, struct file * file)
289 goto Done; 290 goto Done;
290 Eaccess: 291 Eaccess:
291 error = -EACCES; 292 error = -EACCES;
293 Enomem:
292 module_put(attr->ca_owner); 294 module_put(attr->ca_owner);
293 Done: 295 Done:
294 if (error && item) 296 if (error && item)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 867f93d0417..6da6b14d5a6 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -519,6 +519,7 @@ static int receive_from_sock(void)
519 msg.msg_flags = 0; 519 msg.msg_flags = 0;
520 msg.msg_control = incmsg; 520 msg.msg_control = incmsg;
521 msg.msg_controllen = sizeof(incmsg); 521 msg.msg_controllen = sizeof(incmsg);
522 msg.msg_iovlen = 1;
522 523
523 /* I don't see why this circular buffer stuff is necessary for SCTP 524 /* I don't see why this circular buffer stuff is necessary for SCTP
524 * which is a packet-based protocol, but the whole thing breaks under 525 * which is a packet-based protocol, but the whole thing breaks under
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 7a11b8ae664..5938a232d11 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 f4b8f8b3fbd..8337451e789 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/gfs2/bmap.c b/fs/gfs2/bmap.c
index cc57f2ecd21..06e9a8cb45e 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -434,8 +434,7 @@ static int lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
434 */ 434 */
435 435
436static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create, 436static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create,
437 struct buffer_head *bh_map, struct metapath *mp, 437 struct buffer_head *bh_map, struct metapath *mp)
438 unsigned int maxlen)
439{ 438{
440 struct gfs2_inode *ip = GFS2_I(inode); 439 struct gfs2_inode *ip = GFS2_I(inode);
441 struct gfs2_sbd *sdp = GFS2_SB(inode); 440 struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -448,6 +447,7 @@ static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create,
448 int new = 0; 447 int new = 0;
449 u64 dblock = 0; 448 u64 dblock = 0;
450 int boundary; 449 int boundary;
450 unsigned int maxlen = bh_map->b_size >> inode->i_blkbits;
451 451
452 BUG_ON(maxlen == 0); 452 BUG_ON(maxlen == 0);
453 453
@@ -541,13 +541,13 @@ static inline void bmap_unlock(struct inode *inode, int create)
541} 541}
542 542
543int gfs2_block_map(struct inode *inode, u64 lblock, int create, 543int gfs2_block_map(struct inode *inode, u64 lblock, int create,
544 struct buffer_head *bh, unsigned int maxlen) 544 struct buffer_head *bh)
545{ 545{
546 struct metapath mp; 546 struct metapath mp;
547 int ret; 547 int ret;
548 548
549 bmap_lock(inode, create); 549 bmap_lock(inode, create);
550 ret = gfs2_block_pointers(inode, lblock, create, bh, &mp, maxlen); 550 ret = gfs2_block_pointers(inode, lblock, create, bh, &mp);
551 bmap_unlock(inode, create); 551 bmap_unlock(inode, create);
552 return ret; 552 return ret;
553} 553}
@@ -555,7 +555,7 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create,
555int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen) 555int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen)
556{ 556{
557 struct metapath mp; 557 struct metapath mp;
558 struct buffer_head bh = { .b_state = 0, .b_blocknr = 0, .b_size = 0 }; 558 struct buffer_head bh = { .b_state = 0, .b_blocknr = 0 };
559 int ret; 559 int ret;
560 int create = *new; 560 int create = *new;
561 561
@@ -563,8 +563,9 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
563 BUG_ON(!dblock); 563 BUG_ON(!dblock);
564 BUG_ON(!new); 564 BUG_ON(!new);
565 565
566 bh.b_size = 1 << (inode->i_blkbits + 5);
566 bmap_lock(inode, create); 567 bmap_lock(inode, create);
567 ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp, 32); 568 ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp);
568 bmap_unlock(inode, create); 569 bmap_unlock(inode, create);
569 *extlen = bh.b_size >> inode->i_blkbits; 570 *extlen = bh.b_size >> inode->i_blkbits;
570 *dblock = bh.b_blocknr; 571 *dblock = bh.b_blocknr;
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h
index 0fd379b4cd9..ac2fd04370d 100644
--- a/fs/gfs2/bmap.h
+++ b/fs/gfs2/bmap.h
@@ -15,7 +15,7 @@ struct gfs2_inode;
15struct page; 15struct page;
16 16
17int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); 17int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
18int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh, unsigned int maxlen); 18int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh);
19int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); 19int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen);
20 20
21int gfs2_truncatei(struct gfs2_inode *ip, u64 size); 21int gfs2_truncatei(struct gfs2_inode *ip, u64 size);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 459498cac93..e24af28b1a1 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -184,7 +184,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
184 while (copied < size) { 184 while (copied < size) {
185 unsigned int amount; 185 unsigned int amount;
186 struct buffer_head *bh; 186 struct buffer_head *bh;
187 int new; 187 int new = 0;
188 188
189 amount = size - copied; 189 amount = size - copied;
190 if (amount > sdp->sd_sb.sb_bsize - o) 190 if (amount > sdp->sd_sb.sb_bsize - o)
@@ -212,8 +212,6 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
212 gfs2_trans_add_bh(ip->i_gl, bh, 1); 212 gfs2_trans_add_bh(ip->i_gl, bh, 1);
213 memcpy(bh->b_data + o, buf, amount); 213 memcpy(bh->b_data + o, buf, amount);
214 brelse(bh); 214 brelse(bh);
215 if (error)
216 goto fail;
217 215
218 buf += amount; 216 buf += amount;
219 copied += amount; 217 copied += amount;
@@ -317,8 +315,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
317 if (!ra) 315 if (!ra)
318 extlen = 1; 316 extlen = 1;
319 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); 317 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
320 } 318 } else {
321 if (!bh) {
322 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh); 319 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh);
323 if (error) 320 if (error)
324 goto fail; 321 goto fail;
@@ -332,7 +329,6 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
332 extlen--; 329 extlen--;
333 memcpy(buf, bh->b_data + o, amount); 330 memcpy(buf, bh->b_data + o, amount);
334 brelse(bh); 331 brelse(bh);
335 bh = NULL;
336 buf += amount; 332 buf += amount;
337 copied += amount; 333 copied += amount;
338 lblock++; 334 lblock++;
@@ -815,7 +811,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
815 leaf = (struct gfs2_leaf *)bh->b_data; 811 leaf = (struct gfs2_leaf *)bh->b_data;
816 leaf->lf_depth = cpu_to_be16(depth); 812 leaf->lf_depth = cpu_to_be16(depth);
817 leaf->lf_entries = 0; 813 leaf->lf_entries = 0;
818 leaf->lf_dirent_format = cpu_to_be16(GFS2_FORMAT_DE); 814 leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
819 leaf->lf_next = 0; 815 leaf->lf_next = 0;
820 memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved)); 816 memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved));
821 dent = (struct gfs2_dirent *)(leaf+1); 817 dent = (struct gfs2_dirent *)(leaf+1);
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 72eec6542d6..0cace3da9db 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -312,10 +312,12 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
312 312
313static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) 313static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
314{ 314{
315 struct inode *inode = sdp->sd_jdesc->jd_inode;
315 int error; 316 int error;
316 struct buffer_head bh_map; 317 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
317 318
318 error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, 0, &bh_map, 1); 319 bh_map.b_size = 1 << inode->i_blkbits;
320 error = gfs2_block_map(inode, lbn, 0, &bh_map);
319 if (error || !bh_map.b_blocknr) 321 if (error || !bh_map.b_blocknr)
320 printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn); 322 printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn);
321 gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr); 323 gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index e0599fed99c..8d5963c7e12 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -65,7 +65,7 @@ static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
65int gfs2_get_block(struct inode *inode, sector_t lblock, 65int gfs2_get_block(struct inode *inode, sector_t lblock,
66 struct buffer_head *bh_result, int create) 66 struct buffer_head *bh_result, int create)
67{ 67{
68 return gfs2_block_map(inode, lblock, create, bh_result, 32); 68 return gfs2_block_map(inode, lblock, create, bh_result);
69} 69}
70 70
71/** 71/**
@@ -83,7 +83,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
83{ 83{
84 int error; 84 int error;
85 85
86 error = gfs2_block_map(inode, lblock, 0, bh_result, 1); 86 error = gfs2_block_map(inode, lblock, 0, bh_result);
87 if (error) 87 if (error)
88 return error; 88 return error;
89 if (bh_result->b_blocknr == 0) 89 if (bh_result->b_blocknr == 0)
@@ -94,7 +94,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
94static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, 94static int gfs2_get_block_direct(struct inode *inode, sector_t lblock,
95 struct buffer_head *bh_result, int create) 95 struct buffer_head *bh_result, int create)
96{ 96{
97 return gfs2_block_map(inode, lblock, 0, bh_result, 32); 97 return gfs2_block_map(inode, lblock, 0, bh_result);
98} 98}
99 99
100/** 100/**
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 178b3391184..882873a6bd6 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -794,8 +794,8 @@ static int fill_super_meta(struct super_block *sb, struct super_block *new,
794 fs_err(sdp, "can't get root dentry\n"); 794 fs_err(sdp, "can't get root dentry\n");
795 error = -ENOMEM; 795 error = -ENOMEM;
796 iput(inode); 796 iput(inode);
797 } 797 } else
798 new->s_root->d_op = &gfs2_dops; 798 new->s_root->d_op = &gfs2_dops;
799 799
800 return error; 800 return error;
801} 801}
@@ -854,7 +854,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
854 int error = 0; 854 int error = 0;
855 struct super_block *sb = NULL, *new; 855 struct super_block *sb = NULL, *new;
856 struct gfs2_sbd *sdp; 856 struct gfs2_sbd *sdp;
857 char *gfs2mnt = NULL;
858 857
859 sb = get_gfs2_sb(dev_name); 858 sb = get_gfs2_sb(dev_name);
860 if (!sb) { 859 if (!sb) {
@@ -892,8 +891,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
892 atomic_inc(&sdp->sd_gfs2mnt->mnt_count); 891 atomic_inc(&sdp->sd_gfs2mnt->mnt_count);
893 return simple_set_mnt(mnt, new); 892 return simple_set_mnt(mnt, new);
894error: 893error:
895 if (gfs2mnt)
896 kfree(gfs2mnt);
897 return error; 894 return error;
898} 895}
899 896
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index c69b94a5558..a3deae7416c 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -251,7 +251,7 @@ static int bh_get(struct gfs2_quota_data *qd)
251 unsigned int block, offset; 251 unsigned int block, offset;
252 struct buffer_head *bh; 252 struct buffer_head *bh;
253 int error; 253 int error;
254 struct buffer_head bh_map; 254 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
255 255
256 mutex_lock(&sdp->sd_quota_mutex); 256 mutex_lock(&sdp->sd_quota_mutex);
257 257
@@ -263,7 +263,8 @@ static int bh_get(struct gfs2_quota_data *qd)
263 block = qd->qd_slot / sdp->sd_qc_per_block; 263 block = qd->qd_slot / sdp->sd_qc_per_block;
264 offset = qd->qd_slot % sdp->sd_qc_per_block;; 264 offset = qd->qd_slot % sdp->sd_qc_per_block;;
265 265
266 error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map, 1); 266 bh_map.b_size = 1 << ip->i_inode.i_blkbits;
267 error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map);
267 if (error) 268 if (error)
268 goto fail; 269 goto fail;
269 error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); 270 error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh);
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 0a8a4b87dcc..62cd223819b 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -372,11 +372,12 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
372 u32 hash; 372 u32 hash;
373 struct buffer_head *bh; 373 struct buffer_head *bh;
374 int error; 374 int error;
375 struct buffer_head bh_map; 375 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
376 376
377 lblock = head->lh_blkno; 377 lblock = head->lh_blkno;
378 gfs2_replay_incr_blk(sdp, &lblock); 378 gfs2_replay_incr_blk(sdp, &lblock);
379 error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map, 1); 379 bh_map.b_size = 1 << ip->i_inode.i_blkbits;
380 error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map);
380 if (error) 381 if (error)
381 return error; 382 return error;
382 if (!bh_map.b_blocknr) { 383 if (!bh_map.b_blocknr) {
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index e1b3c8af4d1..d5c63047a8b 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 149957bef90..b6cf2be845a 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 e8c7765419e..b85a0ad2cfb 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 e0179f8c327..eb243edf893 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 399ad11b97b..0ce5c81ff50 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 814c6064c9e..7e219b93855 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 6a931f4ab75..32e99a6e8dc 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 b9926ce8782..6220dc2a3f2 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 7dac96e6c82..e83024e1604 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 61c46facf25..b7c949256e5 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 36eb175ec33..f4c0b2b9f75 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 5676163d26e..db3d7919c60 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 97cf8f71451..72e55d83756 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 29f93219205..f8ea1f51f59 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 34c3996bd0f..5fea638743e 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 481f8892a91..4133ef5264e 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 9f7f8b9ea1e..bdfabf854a5 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 bc9376ca86c..08cc4c5919a 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 bea0b016bd7..d205466233f 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 d507b021207..f75fe72b416 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 b49501fc0a7..3be4e72a022 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 3b234d4601e..e5f128ffc32 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 16556fa4eff..0ace092d126 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 61095fe4b5c..6f346677332 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 47c7e6e3910..8118036cc44 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 3dd413f52da..0cf3fa312a3 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 28659a919d6..28108c82b88 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 f6675d2c386..883dd4a1c15 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 0c2be8c0307..c11f5375d7c 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 e13fa23bd10..f37df46d2ea 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 9b9e7e127c0..11fdaf7721b 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 9187755661d..e3eca081698 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 d4bdc00c116..fcad2895ddb 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 a5ebc7dbb38..64db601c2bd 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 247d518248b..b4baca3053c 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 324a278f280..f57655a7a2b 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 d1fac6872c4..0a7bbdc4a10 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 1cbd2e4ee12..e9d07704680 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 ebcf226a9e4..293b6495829 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 41fc241b729..f3f239db04b 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 fdf7cf3dfad..6100bbe2743 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 501d8388453..727ab3bd450 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 9ee1dab5d44..ec983b77768 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 013b38996e6..0aaccb03bf7 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 1135c0d1455..56ebb1443e0 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 1141bd29e4e..f21e917bb8e 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/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index e1fceb8aa32..d11753c50bc 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -152,14 +152,16 @@ static struct o2nm_node *o2nm_node_ip_tree_lookup(struct o2nm_cluster *cluster,
152 struct o2nm_node *node, *ret = NULL; 152 struct o2nm_node *node, *ret = NULL;
153 153
154 while (*p) { 154 while (*p) {
155 int cmp;
156
155 parent = *p; 157 parent = *p;
156 node = rb_entry(parent, struct o2nm_node, nd_ip_node); 158 node = rb_entry(parent, struct o2nm_node, nd_ip_node);
157 159
158 if (memcmp(&ip_needle, &node->nd_ipv4_address, 160 cmp = memcmp(&ip_needle, &node->nd_ipv4_address,
159 sizeof(ip_needle)) < 0) 161 sizeof(ip_needle));
162 if (cmp < 0)
160 p = &(*p)->rb_left; 163 p = &(*p)->rb_left;
161 else if (memcmp(&ip_needle, &node->nd_ipv4_address, 164 else if (cmp > 0)
162 sizeof(ip_needle)) > 0)
163 p = &(*p)->rb_right; 165 p = &(*p)->rb_right;
164 else { 166 else {
165 ret = node; 167 ret = node;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d9ba0a931a0..1be74c4e781 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -30,6 +30,7 @@
30#include <linux/highmem.h> 30#include <linux/highmem.h>
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <linux/uio.h> 32#include <linux/uio.h>
33#include <linux/sched.h>
33 34
34#define MLOG_MASK_PREFIX ML_INODE 35#define MLOG_MASK_PREFIX ML_INODE
35#include <cluster/masklog.h> 36#include <cluster/masklog.h>
@@ -691,6 +692,12 @@ static int ocfs2_zero_extend(struct inode *inode,
691 } 692 }
692 693
693 start_off += sb->s_blocksize; 694 start_off += sb->s_blocksize;
695
696 /*
697 * Very large extends have the potential to lock up
698 * the cpu for extended periods of time.
699 */
700 cond_resched();
694 } 701 }
695 702
696out: 703out:
@@ -728,31 +735,36 @@ static int ocfs2_extend_file(struct inode *inode,
728 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) - 735 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size) -
729 OCFS2_I(inode)->ip_clusters; 736 OCFS2_I(inode)->ip_clusters;
730 737
731 if (clusters_to_add) { 738 /*
732 /* 739 * protect the pages that ocfs2_zero_extend is going to be
733 * protect the pages that ocfs2_zero_extend is going to 740 * pulling into the page cache.. we do this before the
734 * be pulling into the page cache.. we do this before the 741 * metadata extend so that we don't get into the situation
735 * metadata extend so that we don't get into the situation 742 * where we've extended the metadata but can't get the data
736 * where we've extended the metadata but can't get the data 743 * lock to zero.
737 * lock to zero. 744 */
738 */ 745 ret = ocfs2_data_lock(inode, 1);
739 ret = ocfs2_data_lock(inode, 1); 746 if (ret < 0) {
740 if (ret < 0) { 747 mlog_errno(ret);
741 mlog_errno(ret); 748 goto out;
742 goto out; 749 }
743 }
744 750
751 if (clusters_to_add) {
745 ret = ocfs2_extend_allocation(inode, clusters_to_add); 752 ret = ocfs2_extend_allocation(inode, clusters_to_add);
746 if (ret < 0) { 753 if (ret < 0) {
747 mlog_errno(ret); 754 mlog_errno(ret);
748 goto out_unlock; 755 goto out_unlock;
749 } 756 }
757 }
750 758
751 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip); 759 /*
752 if (ret < 0) { 760 * Call this even if we don't add any clusters to the tree. We
753 mlog_errno(ret); 761 * still need to zero the area between the old i_size and the
754 goto out_unlock; 762 * new i_size.
755 } 763 */
764 ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
765 if (ret < 0) {
766 mlog_errno(ret);
767 goto out_unlock;
756 } 768 }
757 769
758 if (!tail_to_skip) { 770 if (!tail_to_skip) {
@@ -764,8 +776,7 @@ static int ocfs2_extend_file(struct inode *inode,
764 } 776 }
765 777
766out_unlock: 778out_unlock:
767 if (clusters_to_add) /* this is the only case in which we lock */ 779 ocfs2_data_unlock(inode, 1);
768 ocfs2_data_unlock(inode, 1);
769 780
770out: 781out:
771 return ret; 782 return ret;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 259155f0eb2..a57b751d4f4 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1085,14 +1085,6 @@ static int ocfs2_rename(struct inode *old_dir,
1085 BUG(); 1085 BUG();
1086 } 1086 }
1087 1087
1088 if (atomic_read(&old_dentry->d_count) > 2) {
1089 shrink_dcache_parent(old_dentry);
1090 if (atomic_read(&old_dentry->d_count) > 2) {
1091 status = -EBUSY;
1092 goto bail;
1093 }
1094 }
1095
1096 /* Assume a directory heirarchy thusly: 1088 /* Assume a directory heirarchy thusly:
1097 * a/b/c 1089 * a/b/c
1098 * a/d 1090 * a/d
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 26a8f8416b7..8df27401d29 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 ad8cbc49883..85ce2326830 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 d5973758981..004baf60061 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 9bbadafdcb0..db5f5a3608c 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