diff options
author | ps <ps@FreeBSD.org> | 2004-12-16 19:28:37 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2004-12-16 19:28:37 +0000 |
commit | 0a2e8227c4ae6d6c6969ad77f2988a8114042b40 (patch) | |
tree | 839f71e28c91966433a99d9b0d1ed9e8c4212f1d /sys/nfsclient/nfs_vnops.c | |
parent | 057c46b46b05d190a47d6328f95c4dcb288b4df7 (diff) | |
download | FreeBSD-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/nfs_vnops.c')
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 28 |
1 files changed, 17 insertions, 11 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) |