[linux-cifs-client] Re: SuSE kernel and cifs; LTC 6768-Preview 4; SuSE bugzilla

Steven French sfrench at us.ibm.com
Thu Apr 15 12:53:46 GMT 2004






It works with the aop cifs_readpages commented out in fs/cifs/file.c ...

I have narrowed the page leak down that was causing the cifs  vfs to leak
memory (which eventually was causing some of the testcases I was running to
fail, including fsx and presumably was causing your copy of very large
files too fail as well).  I disabled cifs_readpages (the multipage
readahead) entrypoint (so all reads are forced instead to use the simpler
cifs_readpage) implying that the bug is in cifs_readpages or
cifs_copy_cache_pages.   To disable cifs_readpages one can simply comment
out the line

             /* .readpages = cifs_readpages, */

near the end of fs/cifs/file.c

I did a complete walkthrough yesterday of all the kmalloc/kfree calls (or
equivalent indirect memory allocations) in my code and found some minor
error paths (mostly in mount failures and one on an unmount failure) that
could leak small amounts but nothing in cifs_readpages itself. The 1.07
version of the cifs vfs (now in bitkeeper bk://cifs.bkbits.net/linux-2.5
cifs) includes these fixes for the mount/unmount leaks.  The only one of
those fixes that looked
like it fixes a potentially serious leak is one path in the reconnection
logic that could leak, although that is not what caused the stress case
errors.

The task for today is to crawl through cifs_readpages and
cifs_copy_cache_pages line by line to check that all of the required
cache/page mgmnt steps are done and that pages are moved onto the right
queues and released properly.  The only two decent examples to compare
against are the mm readahead code path in read_pages in mm/readahead.c
(when the aops->readpages entry point is not present for a particular fs)
and in local filesystem readpages common code (in fs/mpage.c)

I need to make sure all essential steps are done e.g. see the following
piece from the mm read_pages code(which I thought the cifs_readpages and
cifs_copy_cache_pages was already doing correctly):

111         pagevec_init(&lru_pvec, 0);
112         for (page_idx = 0; page_idx < nr_pages; page_idx++) {
113                 struct page *page = list_to_page(pages);
114                 list_del(&page->list);
115                 if (!add_to_page_cache(page, mapping,
116                                         page->index, GFP_KERNEL)) {
117                         mapping->a_ops->readpage(filp, page);
118                         if (!pagevec_add(&lru_pvec, page))
119                                 __pagevec_lru_add(&lru_pvec);
120                 } else {
121                         page_cache_release(page);
122                 }
123         }
124         pagevec_lru_add(&lru_pvec);



Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench at-sign us dot ibm dot com
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the linux-cifs-client mailing list