Re: Write delegation

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

 



Hi Trond,

I just find the function nfs_fscache_set_inode_cookie() that checks
the access flag and allows only read-only files to use the cache.

Thanks!

best,

Yudong

On Thu, Aug 5, 2010 at 11:10 AM, Yudong Gao <stgyd@xxxxxxxxx> wrote:
> I see. I was kind of confused before. Sorry about that.
>
> I am trying to figure out how this read-only is supported in the
> source code. When a page is read from the network through
> nfs_readpage(), it will be cached to fscache, as implemented in
> nfs_readpage_release(). The code in nfs_readpage_release() only checks
> whether fscache is available, and if so, the page will be cached to
> fscache.
>
> If a page is modified locally in memory (the page cache), then it
> becomes dirty. But since the fscache is read-only, the copy of the
> page in fscache becomes stale. When the file is close, the dirty page
> will be written back to the server. Later when it is not used for a
> while, it will be removed from the page cache. Here I suppose the copy
> in fscache will not be deleted, or fscache becomes useless: it can
> only mirror the pages in the page cache and does not provide extra
> cache. And actually in the source code, I can not find the code to
> uncache the page in fscache().
>
> So far so good. But if later this page is read again, the behavior
> becomes strange. The nfs_readpage() checks first try to read the page
> from fscache. In this case, it will read the stale page and oops!
>
> I think the problem here is that when a page become dirty in page
> cache, it should be removed from fscache. So my question is where is
> this implemented?
>
> Thanks a lot!
>
> best,
>
> Yudong
>
> On Wed, Aug 4, 2010 at 6:25 PM, Trond Myklebust
> <trond.myklebust@xxxxxxxxxx> wrote:
>> On Wed, 2010-08-04 at 18:22 -0700, Yudong Gao wrote:
>>
>>> But for the integration with NFS, it is confusing. The
>>> fscache_write_page() is called only in one place:
>>> nfs_readpage_release(). So a NFS page is only written to fscache after
>>> it is read from the server in nfs_readpage. So my question is, if a
>>> page is locally modified, when its data is propagated to fscache? I
>>> check the nfs_write_begin() and nfs_write_end() but cannot find any
>>> relative implementation.
>>
>> See my previous answer. fscache only supports read-only files in NFS.
>>
>> Trond
>>
>>
>
--
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


[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