Commit 9ce137eee4febaabca81143be07d4205d2bd52d4

Authored by J. Bruce Fields
1 parent 9ee1ba5402

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>

Showing 3 changed files with 3 additions and 44 deletions Side-by-side Diff

1   -#define MSNFS /* HACK HACK */
2 1 /*
3 2 * NFS exporting and validation.
4 3 *
... ... @@ -1444,9 +1443,6 @@
1444 1443 { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
1445 1444 { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
1446 1445 { NFSEXP_V4ROOT, {"v4root", ""}},
1447   -#ifdef MSNFS
1448   - { NFSEXP_MSNFS, {"msnfs", ""}},
1449   -#endif
1450 1446 { 0, {"", ""}}
1451 1447 };
1452 1448  
1   -#define MSNFS /* HACK HACK */
2 1 /*
3 2 * File operations used by nfsd. Some of these have been ripped from
4 3 * other parts of the kernel because they weren't exported, others
... ... @@ -875,15 +874,6 @@
875 874 return __splice_from_pipe(pipe, sd, nfsd_splice_actor);
876 875 }
877 876  
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   -
887 877 static __be32
888 878 nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
889 879 loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
... ... @@ -896,9 +886,6 @@
896 886 err = nfserr_perm;
897 887 inode = file->f_path.dentry->d_inode;
898 888  
899   - if (svc_msnfs(fhp) && !lock_may_read(inode, offset, *count))
900   - goto out;
901   -
902 889 if (file->f_op->splice_read && rqstp->rq_splice_ok) {
903 890 struct splice_desc sd = {
904 891 .len = 0,
... ... @@ -923,7 +910,6 @@
923 910 fsnotify_access(file);
924 911 } else
925 912 err = nfserrno(host_err);
926   -out:
927 913 return err;
928 914 }
929 915  
... ... @@ -988,14 +974,6 @@
988 974 int stable = *stablep;
989 975 int use_wgather;
990 976  
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   -
999 977 dentry = file->f_path.dentry;
1000 978 inode = dentry->d_inode;
1001 979 exp = fhp->fh_export;
... ... @@ -1046,7 +1024,6 @@
1046 1024 err = 0;
1047 1025 else
1048 1026 err = nfserrno(host_err);
1049   -out:
1050 1027 return err;
1051 1028 }
1052 1029  
... ... @@ -1751,13 +1728,6 @@
1751 1728 if (ndentry == trap)
1752 1729 goto out_dput_new;
1753 1730  
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   -
1761 1731 host_err = -EXDEV;
1762 1732 if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
1763 1733 goto out_dput_new;
1764 1734  
1765 1735  
... ... @@ -1836,17 +1806,10 @@
1836 1806 if (host_err)
1837 1807 goto out_nfserr;
1838 1808  
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)
1846 1810 host_err = vfs_unlink(dirp, rdentry);
1847   - } else { /* It's RMDIR */
  1811 + else
1848 1812 host_err = vfs_rmdir(dirp, rdentry);
1849   - }
1850 1813  
1851 1814 dput(rdentry);
1852 1815  
include/linux/nfsd/export.h
... ... @@ -35,7 +35,7 @@
35 35 #define NFSEXP_NOHIDE 0x0200
36 36 #define NFSEXP_NOSUBTREECHECK 0x0400
37 37 #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 */
39 39 #define NFSEXP_FSID 0x2000
40 40 #define NFSEXP_CROSSMOUNT 0x4000
41 41 #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */