All of lore.kernel.org
 help / color / mirror / Atom feed
* may i ask a question about nfs fs ? thanks a lot.
       [not found] <201202012212229514260@300.cn>
@ 2012-02-01 16:09 ` wangjing
  2012-02-02  1:30   ` Jim Rees
                     ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wangjing @ 2012-02-01 16:09 UTC (permalink / raw)
  To: linux-nfs

DQptYXkgaSBhc2sgYSBxdWVzdGlvbj8gdGhhbmtzIGEgbG90Lg0KDQp0aGUgYmFja2dyb3VuZA0K
ICAgMaGiTGludXggZnMgaGFzICAgL25mc21udC93b3JrX3B1Yi93ZWIgYW5kIC9uZnNtbnQvd29y
a19pbndvcmsvd2ViIKOsdGhleSB1c2UgTkZTIFYzIG1vdW50DQogICAyoaJ0aGVyZSBpcyBtYW55
IHByb2Nlc3Mgd2lsbCByZWFkIGFuZCB3cml0ZSBmaWxlcyBpbiB0aGUgZGlyIC9uZnNtbnQvd29y
a19wdWIvd2ViIA0KICAgM6GiY3JvbiB3aWxsIGRlbCAgYWxsIGZpbGVzIGluIGRpciAgL25mc21u
dC93b3JrX3B1Yi93ZWIgaW4gcGVyaW9ko6xhbmQgd2lsbCBjb3B5IGFsbCB0aGUgZmlsZXMgd2hp
Y2ggaW4gdGhlIGRpciAvbmZzbW50L3dvcmtfaW53b3JrL3dlYiANCg0KaW4gc29tZSB0aW1lcyBk
ZWxldGUgYWxsIGZpbGVzIGluICAvbmZzbW50L3dvcmtfcHViL3dlYiB3aWxsIGZhaWxkICxiZWNh
dXNlIHRoZXJlIGlzIHNvbWUgLm5mc1hYWFgNCg0KDQoNCk15IHF1ZXN0aW9uIGlzIDpjYW4gaSBt
b2RpZnkgbmZzX3NpbGx5cmVuYW1lIGZ1bm5jaW9uICBpbiB0aGUgZnMvbmZzL2Rpci5jICwgZ2Vu
ZXJhbCBhbGwgLm5mc1hYWCBpbiAvdG1wLGFuZCBtYWtlIGtlcm5lbCA/DQoNCg0KDQpzdGF0aWMg
aW50IG5mc19zaWxseXJlbm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
ZGlyLCAmZGVudHJ5LT5kX25hbWUsIGRpciwgJnFzaWxseSk7ICAvL2NhbiBpIG1vZGlmeSB0aGlz
IHRvIHNvbHZlIG15IGlzc2l1ZSAgv8m38dDeuMQgtMu0prT6wuvAtL3ivvbOysziDQppZiAoIWVy
cm9yKSB7DQpuZnNfcmVuZXdfdGltZXMoZGVudHJ5KTsNCmRfbW92ZShkZW50cnksIHNkZW50cnkp
Ow0KZXJyb3IgPSBuZnNfYXN5bmNfdW5saW5rKGRlbnRyeSk7DQogIC8qIElmIHdlIHJldHVybiAw
IHdlIGRvbid0IHVubGluayAqLw0KfQ0KZHB1dChzZGVudHJ5KTsNCm91dDoNCnJldHVybiBlcnJv
cjsNCn0NCg0KDQoNCg0KMjAxMi0wMi0wMSANCndhbmdqaW5nDQo=


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: may i ask a question about nfs fs ? thanks a lot.
  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
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jim Rees @ 2012-02-02  1:30 UTC (permalink / raw)
  To: wangjing; +Cc: linux-nfs

wangjing wrote:

  may i ask a question? thanks a lot.

Not trying to be difficult, but you'll have better luck if you:

1. Use a descriptive subject. Something like "modify sillyrename to put
files in /tmp".

2. Run your code through indent(1).  It's unreadable as-is.

3. Use an international standard character set, like utf-8.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:Re: may i ask a question about nfs fs ? thanks a lot. 
  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
  3 siblings, 0 replies; 5+ messages in thread
From: wangjing @ 2012-02-02  2:14 UTC (permalink / raw)
  To: Jim Rees; +Cc: linux-nfs

thanks for your help.

In nfs v3 ,if mulity process visit nfs mount nfs dir ,there sometimes occour .nfsXXX can't delete .

if modify sillyrename to put files in /tmp ,it will be more friendly to nfs user.


2012-02-02 
wangjing 




 Re: may i ask a question about nfs fs ? thanks a lot. 
 
wangjing wrote:
  may i ask a question? thanks a lot.
Not trying to be difficult, but you'll have better luck if you:
1. Use a descriptive subject. Something like "modify sillyrename to put
files in /tmp".
2. Run your code through indent(1).  It's unreadable as-is.
3. Use an international standard character set, like utf-8.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: may i ask a question about nfs fs ? thanks a lot.
  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
  3 siblings, 0 replies; 5+ messages in thread
From: Boaz Harrosh @ 2012-02-02  9:47 UTC (permalink / raw)
  To: wangjing; +Cc: linux-nfs

On 02/01/2012 06:09 PM, 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 ?
> 
> 

You can't do this. /tmp on the client is on a different superblock than the nfs mount, and the point of
sillyrename is that it is a rename and not a move. (i.e same inode)

The /tmp on the server is not even accessible on the client, which does the sillyrename.

You'll have to better your scripts to loop and delete until all  .nfsXXXX go away because
these are temporarily there until the application on the client stops using the file.

Cheers
Boaz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: may i ask a question about nfs fs ? thanks a lot.
  2012-02-01 16:09 ` may i ask a question about nfs fs ? thanks a lot wangjing
                     ` (2 preceding siblings ...)
  2012-02-02  9:47   ` Boaz Harrosh
@ 2012-03-07 10:11   ` sword
  3 siblings, 0 replies; 5+ messages in thread
From: sword @ 2012-03-07 10:11 UTC (permalink / raw)
  To: wangjing; +Cc: linux-nfs

何不直接去掉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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-07  9:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.