何不直接去掉sillyrename功能,反正要暴力删除文件。 放到/tmp不大可能。 cron应该在client, 否则怎能有删不掉的文件?! 把它放到server端吧... On Thu, 2012-02-02 at 00:09 +0800, wangjing wrote: > 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Р骒rybX肚v^)藓{.n+伐{"^nr■zhㄨ&ⅧGh(茛j"m赇z罐帼f"h~m -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html