diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
commit | f969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch) | |
tree | b3530d803df59d726afaabebc6626987dee1ca05 /fs/nfsd | |
parent | a10ce7ef2066b455d69187643ddf2073bfc4db24 (diff) |
Merge with 2.3.27.
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfsctl.c | 24 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 104 | ||||
-rw-r--r-- | fs/nfsd/stats.c | 5 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 9 |
4 files changed, 64 insertions, 78 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 4ec7b691b..8c575db4e 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -57,13 +57,9 @@ int exp_procfs_exports(char *buffer, char **start, off_t offset, void proc_export_init(void) { - struct proc_dir_entry *nfs_export_ent = NULL; - - if (!(nfs_export_ent = create_proc_entry("fs/nfs", S_IFDIR, 0))) - return; - if (!(nfs_export_ent = create_proc_entry("fs/nfs/exports", 0, 0))) + if (!create_proc_entry("fs/nfs", S_IFDIR, 0)) return; - nfs_export_ent->read_proc = exp_procfs_exports; + create_proc_read_entry("fs/nfs/exports", 0, 0, exp_procfs_exports,NULL); } @@ -261,21 +257,6 @@ MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); extern int (*do_nfsservctl)(int, void *, void *); /* - * This is called as the fill_inode function when an inode - * is going into (fill = 1) or out of service (fill = 0). - * - * We use it here to make sure the module can't be unloaded - * while a /proc inode is in use. - */ -void nfsd_modcount(struct inode *inode, int fill) -{ - if (fill) - MOD_INC_USE_COUNT; - else - MOD_DEC_USE_COUNT; -} - -/* * Initialize the module */ int @@ -299,7 +280,6 @@ cleanup_module(void) do_nfsservctl = NULL; nfsd_export_shutdown(); nfsd_cache_shutdown(); - nfsd_fh_free(); remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs", NULL); nfsd_stat_shutdown(); diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 5f8e90a0e..42ad50fe9 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -279,6 +279,7 @@ find_fh_dentry(struct super_block *sb, struct knfs_fh *fh, int needpath) /* It's a directory, or we are required to confirm the file's * location in the tree. */ + dprintk("nfs_fh: need to look harder for %d/%d\n",sb->s_dev,fh->fh_ino); found = 0; if (!S_ISDIR(result->d_inode->i_mode)) { if (fh->fh_dirino == 0) @@ -381,60 +382,69 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) fh->fh_ino, fh->fh_dirino); - /* - * Security: Check that the fh is internally consistant (from <gam3@acm.org>) - */ - if (fh->fh_dev != fh->fh_xdev) { - printk("fh_verify: Security: export on other device (%s, %s).\n", - kdevname(fh->fh_dev), kdevname(fh->fh_xdev)); - error = nfserr_stale; - nfsdstats.fh_stale++; - goto out; - } + if (!fhp->fh_dverified) { + /* + * Security: Check that the fh is internally consistant (from <gam3@acm.org>) + */ + if (fh->fh_dev != fh->fh_xdev) { + printk("fh_verify: Security: export on other device (%s, %s).\n", + kdevname(fh->fh_dev), kdevname(fh->fh_xdev)); + error = nfserr_stale; + nfsdstats.fh_stale++; + goto out; + } - /* - * Look up the export entry. - */ - error = nfserr_stale; - exp = exp_get(rqstp->rq_client, - u32_to_kdev_t(fh->fh_xdev), - u32_to_ino_t(fh->fh_xino)); - if (!exp) { - /* export entry revoked */ - nfsdstats.fh_stale++; - goto out; - } + /* + * Look up the export entry. + */ + error = nfserr_stale; + exp = exp_get(rqstp->rq_client, + u32_to_kdev_t(fh->fh_xdev), + u32_to_ino_t(fh->fh_xino)); + if (!exp) { + /* export entry revoked */ + nfsdstats.fh_stale++; + goto out; + } - /* Check if the request originated from a secure port. */ - error = nfserr_perm; - if (!rqstp->rq_secure && EX_SECURE(exp)) { - printk(KERN_WARNING - "nfsd: request from insecure port (%08lx:%d)!\n", - ntohl(rqstp->rq_addr.sin_addr.s_addr), - ntohs(rqstp->rq_addr.sin_port)); - goto out; - } + /* Check if the request originated from a secure port. */ + error = nfserr_perm; + if (!rqstp->rq_secure && EX_SECURE(exp)) { + printk(KERN_WARNING + "nfsd: request from insecure port (%08lx:%d)!\n", + ntohl(rqstp->rq_addr.sin_addr.s_addr), + ntohs(rqstp->rq_addr.sin_port)); + goto out; + } - /* Set user creds if we haven't done so already. */ - nfsd_setuser(rqstp, exp); + /* Set user creds if we haven't done so already. */ + nfsd_setuser(rqstp, exp); - /* - * Look up the dentry using the NFS file handle. - */ + /* + * Look up the dentry using the NFS file handle. + */ - dentry = find_fh_dentry(exp->ex_dentry->d_inode->i_sb, - fh, - !(exp->ex_flags & NFSEXP_NOSUBTREECHECK)); + dentry = find_fh_dentry(exp->ex_dentry->d_inode->i_sb, + fh, + !(exp->ex_flags & NFSEXP_NOSUBTREECHECK)); - if (IS_ERR(dentry)) { - error = nfserrno(-PTR_ERR(dentry)); - goto out; - } + if (IS_ERR(dentry)) { + error = nfserrno(-PTR_ERR(dentry)); + goto out; + } - fhp->fh_dentry = dentry; - fhp->fh_export = exp; - fhp->fh_dverified = 1; - nfsd_nr_verified++; + fhp->fh_dentry = dentry; + fhp->fh_export = exp; + fhp->fh_dverified = 1; + nfsd_nr_verified++; + } else { + /* just rechecking permissions + * (e.g. nfsproc_create calls fh_verify, then nfsd_create does as well) + */ + dprintk("nfsd: fh_verify - just checking\n"); + dentry = fhp->fh_dentry; + exp = fhp->fh_export; + } inode = dentry->d_inode; diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index accd0aadc..7e7eba9a9 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c @@ -17,6 +17,7 @@ #include <linux/sched.h> #include <linux/proc_fs.h> #include <linux/stat.h> +#include <linux/module.h> #include <linux/sunrpc/svc.h> #include <linux/sunrpc/stats.h> @@ -77,9 +78,7 @@ nfsd_stat_init(void) if ((ent = svc_proc_register(&nfsd_svcstats)) != 0) { ent->read_proc = nfsd_proc_read; -#ifdef MODULE - ent->fill_inode = nfsd_modcount; -#endif + ent->owner = THIS_MODULE; } } diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index bc849dd8e..398d2ebae 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -657,12 +657,9 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, if (!flen) goto out; - /* from mkdir it won't be verified, from create it will */ - if (!fhp->fh_dverified) { - err = fh_verify(rqstp, fhp, S_IFDIR, MAY_CREATE); - if (err) - goto out; - } + err = fh_verify(rqstp, fhp, S_IFDIR, MAY_CREATE); + if (err) + goto out; dentry = fhp->fh_dentry; dirp = dentry->d_inode; |