Re: [PATCH] cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache

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

 



On Fri, 2013-09-13 at 14:30 +0100, David Howells wrote:
> Looking at this:
> 
> 	static int cifs_readpage_worker(struct file *file, struct page *page,
> 		loff_t *poffset)
> 	{
> 		char *read_data;
> 		int rc;
> 
> 		/* Is the page cached? */
> 		rc = cifs_readpage_from_fscache(file_inode(file), page);
> 		if (rc == 0)
> 			goto read_complete;
> 
> Should you return here if rc == -ENOMEM or -ERESTARTSYS?  That might break
> cifs_write_begin() though - which perhaps ought to check the return value.
> 
> Your patch, however, looks okay otherwise, so feel free to add:
> 
> 	Acked-by: David Howells <dhowells@xxxxxxxxxx>
> 
> David

According to the comment already above the call to
cifs_readpage_worker() in cifs_write_begin():

/*
 * might as well read a page, it is fast enough. If we get
 * an error, we don't need to return it. cifs_write_end will
 * do a sync write instead since PG_uptodate isn't set.
 */

With the patch, we ignore the error and set oncethru to 1 so that we
don't attempt to call cifs_readpage_worker() again and let
cifs_write_end do a sync_write.

Sachin Prabhu

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux