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!
This commit is contained in:
parent
057c46b46b
commit
0a2e8227c4
@ -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)
|
||||
|
@ -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];
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user