may i ask a question about nfs fs ? thanks a lot.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



may i ask a question? thanks a lot.

the background
   1、Linux fs has   /nfsmnt/work_pub/web and /nfsmnt/work_inwork/web ,they use NFS V3 mount
   2、there is many process will read and write files in the dir /nfsmnt/work_pub/web 
   3、cron will del  all files in dir  /nfsmnt/work_pub/web in period,and will copy all the files which in the dir /nfsmnt/work_inwork/web 

in some times delete all files in  /nfsmnt/work_pub/web will faild ,because there is some .nfsXXXX



My question is :can i modify nfs_sillyrename funncion  in the fs/nfs/dir.c , general all .nfsXXX in /tmp,and make kernel ?



static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
{
static unsigned int sillycounter;
const int      i_inosize  = sizeof(dir->i_ino)*2;
const int      countersize = sizeof(sillycounter)*2;
const int      slen       = strlen(".nfs") + i_inosize + countersize;
char           silly[slen+1];
struct qstr    qsilly;
struct dentry *sdentry;
int            error = -EIO;
dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, 
atomic_read(&dentry->d_count));
if (atomic_read(&dentry->d_count) == 1)
goto out;  /* No need to silly rename. */
#ifdef NFS_PARANOIA
if (!dentry->d_inode)
printk("NFS: silly-renaming %s/%s, negative dentry??\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
#endif
/*
 * We don't allow a dentry to be silly-renamed twice.
 */
error = -EBUSY;
if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
goto out;
sprintf(silly, ".nfs%*.*lx",
i_inosize, i_inosize, dentry->d_inode->i_ino);
sdentry = NULL;
do {
char *suffix = silly + slen - countersize;
dput(sdentry);
sillycounter++;
sprintf(suffix, "%*.*x", countersize, countersize, sillycounter);
dfprintk(VFS, "trying to rename %s to %s\n",
 dentry->d_name.name, silly);
sdentry = lookup_one(silly, dentry->d_parent);
/*
 * N.B. Better to return EBUSY here ... it could be
 * dangerous to delete the file while it's in use.
 */
if (IS_ERR(sdentry))
goto out;
} while(sdentry->d_inode != NULL); /* need negative lookup */
nfs_zap_caches(dir);
qsilly.name = silly;
qsilly.len  = strlen(silly);
error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, dir, &qsilly);  //can i modify this to solve my issiue  可否修改 此处代码来解决问题
if (!error) {
nfs_renew_times(dentry);
d_move(dentry, sdentry);
error = nfs_async_unlink(dentry);
  /* If we return 0 we don't unlink */
}
dput(sdentry);
out:
return error;
}




2012-02-01 
wangjing
?韬{.n?????%??檩??w?{.n???{炳w忐)?骅w*jg????????G??⒏⒎?:+v????????????"??????


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux