From: sword <histemiss@gmail.com>
To: wangjing <wangjing@300.cn>
Cc: linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: may i ask a question about nfs fs ? thanks a lot.
Date: Wed, 07 Mar 2012 18:11:27 +0800 [thread overview]
Message-ID: <1331115087.2504.18.camel@jianli.nay.redhat.com> (raw)
In-Reply-To: <201202020009007716206@300.cn>
何不直接去掉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■z\x1ahㄨ&Ⅷ\x1eGh\x03(茛j"\x1a^[m赇z罐帼f"h~m
prev parent reply other threads:[~2012-03-07 9:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201202012212229514260@300.cn>
2012-02-01 16:09 ` may i ask a question about nfs fs ? thanks a lot wangjing
2012-02-02 1:30 ` Jim Rees
2012-02-02 2:14 ` wangjing
2012-02-02 9:47 ` Boaz Harrosh
2012-03-07 10:11 ` sword [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331115087.2504.18.camel@jianli.nay.redhat.com \
--to=histemiss@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=wangjing@300.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).