summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
commitb2ad5f821b1381492d792ca10b1eb7a107b48f14 (patch)
tree954a648692e7da983db1d2470953705f6a729264 /fs/nfsd
parentc9c06167e7933d93a6e396174c68abf242294abb (diff)
Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your
Makefiles.
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/Makefile10
-rw-r--r--fs/nfsd/nfs3xdr.c20
-rw-r--r--fs/nfsd/vfs.c29
3 files changed, 32 insertions, 27 deletions
diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile
index 152a8b0b2..17775d0fb 100644
--- a/fs/nfsd/Makefile
+++ b/fs/nfsd/Makefile
@@ -8,13 +8,13 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := nfsd.o
-O_OBJS := nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
+
+obj-y := nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o nfsxdr.o \
stats.o
-ifdef CONFIG_NFSD_V3
- O_OBJS += nfs3proc.o nfs3xdr.o
-endif
-M_OBJS := $(O_TARGET)
+obj-$(CONFIG_NFSD_V3) += nfs3proc.o nfs3xdr.o
+
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 4cf7c897c..3c14a44c4 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -36,14 +36,6 @@ static u32 nfs3_ftypes[] = {
* XDR functions for basic NFS types
*/
static inline u32 *
-dec64(u32 *p, u64 *valp)
-{
- *valp = ((u64) ntohl(*p++)) << 32;
- *valp |= ntohl(*p++);
- return p;
-}
-
-static inline u32 *
encode_time3(u32 *p, time_t secs)
{
*p++ = htonl((u32) secs); *p++ = 0;
@@ -142,7 +134,7 @@ decode_sattr3(u32 *p, struct iattr *iap)
u64 newsize;
iap->ia_valid |= ATTR_SIZE;
- p = dec64(p, &newsize);
+ p = xdr_decode_hyper(p, &newsize);
if (newsize <= NFS_OFFSET_MAX)
iap->ia_size = newsize;
else
@@ -343,7 +335,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readargs *args)
{
if (!(p = decode_fh(p, &args->fh))
- || !(p = dec64(p, &args->offset)))
+ || !(p = xdr_decode_hyper(p, &args->offset)))
return 0;
args->count = ntohl(*p++);
@@ -355,7 +347,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_writeargs *args)
{
if (!(p = decode_fh(p, &args->fh))
- || !(p = dec64(p, &args->offset)))
+ || !(p = xdr_decode_hyper(p, &args->offset)))
return 0;
args->count = ntohl(*p++);
@@ -471,7 +463,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->cookie);
+ p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ~0;
args->count = ntohl(*p++);
@@ -485,7 +477,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->cookie);
+ p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ntohl(*p++);
args->count = ntohl(*p++);
@@ -499,7 +491,7 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->offset);
+ p = xdr_decode_hyper(p, &args->offset);
args->count = ntohl(*p++);
return xdr_argsize_check(rqstp, p);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index b57b85ca1..bd01b57f5 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -359,8 +359,16 @@ static struct accessmap nfs3_diraccess[] = {
};
static struct accessmap nfs3_anyaccess[] = {
- /* XXX: should we try to cover read/write here for clients that
- * rely on us to do their access checking for special files? */
+ /* Some clients - Solaris 2.6 at least, make an access call
+ * to the server to check for access for things like /dev/null
+ * (which really, the server doesn't care about). So
+ * We provide simple access checking for them, looking
+ * mainly at mode bits
+ */
+ { NFS3_ACCESS_READ, MAY_READ },
+ { NFS3_ACCESS_EXECUTE, MAY_EXEC },
+ { NFS3_ACCESS_MODIFY, MAY_WRITE },
+ { NFS3_ACCESS_EXTEND, MAY_WRITE },
{ 0, 0 }
};
@@ -1501,12 +1509,17 @@ nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
inode->i_uid, inode->i_gid, current->fsuid, current->fsgid);
#endif
- if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
- if (EX_RDONLY(exp) || IS_RDONLY(inode))
- return nfserr_rofs;
- if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
- return nfserr_perm;
- }
+ /* only care about readonly exports for files and
+ * directories. links don't have meaningful write access,
+ * and all else is local to the client
+ */
+ if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))
+ if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
+ if (EX_RDONLY(exp) || IS_RDONLY(inode))
+ return nfserr_rofs;
+ if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
+ return nfserr_perm;
+ }
if ((acc & MAY_TRUNC) && IS_APPEND(inode))
return nfserr_perm;