Skip to content

Commit 9ce137e

Browse files
author
J. Bruce Fields
committed
nfsd: don't support msnfs export option
We've long had these pointless #ifdef MSNFS's sprinkled throughout the code--pointless because MSNFS is always defined (and we give no config option to make that easy to change). So we could just remove the ifdef's and compile the resulting code unconditionally. But as long as we're there: why not just rip out this code entirely? The only purpose is to implement the "msnfs" export option which turns on Windows-like behavior in some cases, and: - the export option isn't documented anywhere; - the userland utilities (which would need to be able to parse "msnfs" in an export file) don't support it; - I don't know how to maintain this, as I don't know what the proper behavior is; and - google shows no evidence that anyone has ever used this. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 9ee1ba5 commit 9ce137e

3 files changed

Lines changed: 3 additions & 44 deletions

File tree

‎fs/nfsd/export.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define MSNFS /* HACK HACK */
21
/*
32
* NFS exporting and validation.
43
*
@@ -1444,9 +1443,6 @@ static struct flags {
14441443
{ NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
14451444
{ NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
14461445
{ NFSEXP_V4ROOT, {"v4root", ""}},
1447-
#ifdef MSNFS
1448-
{ NFSEXP_MSNFS, {"msnfs", ""}},
1449-
#endif
14501446
{ 0, {"", ""}}
14511447
};
14521448

‎fs/nfsd/vfs.c‎

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define MSNFS /* HACK HACK */
21
/*
32
* File operations used by nfsd. Some of these have been ripped from
43
* other parts of the kernel because they weren't exported, others
@@ -875,15 +874,6 @@ static int nfsd_direct_splice_actor(struct pipe_inode_info *pipe,
875874
return __splice_from_pipe(pipe, sd, nfsd_splice_actor);
876875
}
877876

878-
static inline int svc_msnfs(struct svc_fh *ffhp)
879-
{
880-
#ifdef MSNFS
881-
return (ffhp->fh_export->ex_flags & NFSEXP_MSNFS);
882-
#else
883-
return 0;
884-
#endif
885-
}
886-
887877
static __be32
888878
nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
889879
loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
@@ -896,9 +886,6 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
896886
err = nfserr_perm;
897887
inode = file->f_path.dentry->d_inode;
898888

899-
if (svc_msnfs(fhp) && !lock_may_read(inode, offset, *count))
900-
goto out;
901-
902889
if (file->f_op->splice_read && rqstp->rq_splice_ok) {
903890
struct splice_desc sd = {
904891
.len = 0,
@@ -923,7 +910,6 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
923910
fsnotify_access(file);
924911
} else
925912
err = nfserrno(host_err);
926-
out:
927913
return err;
928914
}
929915

@@ -988,14 +974,6 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
988974
int stable = *stablep;
989975
int use_wgather;
990976

991-
#ifdef MSNFS
992-
err = nfserr_perm;
993-
994-
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
995-
(!lock_may_write(file->f_path.dentry->d_inode, offset, *cnt)))
996-
goto out;
997-
#endif
998-
999977
dentry = file->f_path.dentry;
1000978
inode = dentry->d_inode;
1001979
exp = fhp->fh_export;
@@ -1046,7 +1024,6 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
10461024
err = 0;
10471025
else
10481026
err = nfserrno(host_err);
1049-
out:
10501027
return err;
10511028
}
10521029

@@ -1751,13 +1728,6 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
17511728
if (ndentry == trap)
17521729
goto out_dput_new;
17531730

1754-
if (svc_msnfs(ffhp) &&
1755-
((atomic_read(&odentry->d_count) > 1)
1756-
|| (atomic_read(&ndentry->d_count) > 1))) {
1757-
host_err = -EPERM;
1758-
goto out_dput_new;
1759-
}
1760-
17611731
host_err = -EXDEV;
17621732
if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
17631733
goto out_dput_new;
@@ -1836,17 +1806,10 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
18361806
if (host_err)
18371807
goto out_nfserr;
18381808

1839-
if (type != S_IFDIR) { /* It's UNLINK */
1840-
#ifdef MSNFS
1841-
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
1842-
(atomic_read(&rdentry->d_count) > 1)) {
1843-
host_err = -EPERM;
1844-
} else
1845-
#endif
1809+
if (type != S_IFDIR)
18461810
host_err = vfs_unlink(dirp, rdentry);
1847-
} else { /* It's RMDIR */
1811+
else
18481812
host_err = vfs_rmdir(dirp, rdentry);
1849-
}
18501813

18511814
dput(rdentry);
18521815

‎include/linux/nfsd/export.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define NFSEXP_NOHIDE 0x0200
3636
#define NFSEXP_NOSUBTREECHECK 0x0400
3737
#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
38-
#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */
38+
#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */
3939
#define NFSEXP_FSID 0x2000
4040
#define NFSEXP_CROSSMOUNT 0x4000
4141
#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */

0 commit comments

Comments
 (0)