summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2004-12-16 19:28:37 +0000
committerps <ps@FreeBSD.org>2004-12-16 19:28:37 +0000
commit0a2e8227c4ae6d6c6969ad77f2988a8114042b40 (patch)
tree839f71e28c91966433a99d9b0d1ed9e8c4212f1d /sys/nfsclient
parent057c46b46b05d190a47d6328f95c4dcb288b4df7 (diff)
downloadFreeBSD-src-0a2e8227c4ae6d6c6969ad77f2988a8114042b40.zip
FreeBSD-src-0a2e8227c4ae6d6c6969ad77f2988a8114042b40.tar.gz
Change the NFS sillyrename convention so that we won't run out
of sillyrenames (which were limited to 58 per pid per directory, for no good reason). The new format of sillyrenames looks like .nfs.0000b31a.00d24.4 ^^^^^^^^ ^^^^^ ticks pid Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Obtained from: Yahoo!
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vnops.c28
-rw-r--r--sys/nfsclient/nfsnode.h2
2 files changed, 18 insertions, 12 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index dd88e42..79aa5d8 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -2448,6 +2448,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
struct nfsnode *np;
int error;
short pid;
+ unsigned int lticks;
cache_purge(dvp);
np = VTONFS(vp);
@@ -2462,18 +2463,23 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
sp->s_removeit = nfs_removeit;
VREF(dvp);
- /* Fudge together a funny name */
+ /*
+ * Fudge together a funny name.
+ * Changing the format of the funny name to accomodate more
+ * sillynames per directory.
+ * The name is now changed to .nfs.<ticks>.<pid>.4, where ticks is
+ * CPU ticks since boot.
+ */
pid = cnp->cn_thread->td_proc->p_pid;
- sp->s_namlen = sprintf(sp->s_name, ".nfsA%04x4.4", pid);
-
- /* Try lookitups until we get one that isn't there */
- while (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
- cnp->cn_thread, NULL) == 0) {
- sp->s_name[4]++;
- if (sp->s_name[4] > 'z') {
- error = EINVAL;
- goto bad;
- }
+ lticks = (unsigned int)ticks;
+ for ( ; ; ) {
+ sp->s_namlen = sprintf(sp->s_name,
+ ".nfs.%08x.%04x4.4", lticks,
+ pid);
+ if (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
+ cnp->cn_thread, NULL))
+ break;
+ lticks++;
}
error = nfs_renameit(dvp, cnp, sp);
if (error)
diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h
index 4c03183..b6c463f 100644
--- a/sys/nfsclient/nfsnode.h
+++ b/sys/nfsclient/nfsnode.h
@@ -49,7 +49,7 @@ struct sillyrename {
struct vnode *s_dvp;
int (*s_removeit)(struct sillyrename *sp);
long s_namlen;
- char s_name[20];
+ char s_name[32];
};
/*
OpenPOWER on IntegriCloud