Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3369d116 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fixes from Steve French:
 "Two minor cifs fixes and a minor documentation cleanup for cifs.txt"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: update cifs.txt and remove some outdated infos
  cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache
  cifs: Do not take a reference to the page in cifs_readpage_worker()
parents f1da3458 81b66220
Loading
Loading
Loading
Loading
+11 −31
Original line number Original line Diff line number Diff line
  This is the client VFS module for the Common Internet File System
  This is the client VFS module for the Common Internet File System
  (CIFS) protocol which is the successor to the Server Message Block 
  (CIFS) protocol which is the successor to the Server Message Block 
  (SMB) protocol, the native file sharing mechanism for most early
  (SMB) protocol, the native file sharing mechanism for most early
  PC operating systems.  CIFS is fully supported by current network
  PC operating systems. New and improved versions of CIFS are now
  file servers such as Windows 2000, Windows 2003 (including  
  called SMB2 and SMB3. These dialects are also supported by the
  Windows XP) as well by Samba (which provides excellent CIFS
  CIFS VFS module. CIFS is fully supported by network
  file servers such as Windows 2000, 2003, 2008 and 2012
  as well by Samba (which provides excellent CIFS
  server support for Linux and many other operating systems), so
  server support for Linux and many other operating systems), so
  this network filesystem client can mount to a wide variety of
  this network filesystem client can mount to a wide variety of
  servers.  The smbfs module should be used instead of this cifs module
  servers.
  for mounting to older SMB servers such as OS/2.  The smbfs and cifs
  modules can coexist and do not conflict.  The CIFS VFS filesystem
  module is designed to work well with servers that implement the
  newer versions (dialects) of the SMB/CIFS protocol such as Samba, 
  the program written by Andrew Tridgell that turns any Unix host 
  into a SMB/CIFS file server.


  The intent of this module is to provide the most advanced network
  The intent of this module is to provide the most advanced network
  file system function for CIFS compliant servers, including better
  file system function for CIFS compliant servers, including better
@@ -24,28 +20,12 @@
  alternative to NFSv4 for fileserving in some Linux to Linux environments,
  alternative to NFSv4 for fileserving in some Linux to Linux environments,
  not just in Linux to Windows environments.
  not just in Linux to Windows environments.


  This filesystem has an optional mount utility (mount.cifs) that can
  This filesystem has an mount utility (mount.cifs) that can be obtained from
  be obtained from the project page and installed in the path in the same
  directory with the other mount helpers (such as mount.smbfs). 
  Mounting using the cifs filesystem without installing the mount helper
  requires specifying the server's ip address.


  For Linux 2.4:
      https://ftp.samba.org/pub/linux-cifs/cifs-utils/
    mount //anything/here /mnt_target -o
            user=username,pass=password,unc=//ip_address_of_server/sharename


  For Linux 2.5: 
  It must be installed in the directory with the other mount helpers.
    mount //ip_address_of_server/sharename /mnt_target -o user=username, pass=password


  For more information on the module see the project wiki page at


  For more information on the module see the project page at
      https://wiki.samba.org/index.php/LinuxCIFS_utils

      http://us1.samba.org/samba/Linux_CIFS_client.html 

  For more information on CIFS see:

      http://www.snia.org/tech_activities/CIFS

  or the Samba site:
     
      http://www.samba.org
+10 −5
Original line number Original line Diff line number Diff line
@@ -3379,6 +3379,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
	return rc;
	return rc;
}
}


/*
 * cifs_readpage_worker must be called with the page pinned
 */
static int cifs_readpage_worker(struct file *file, struct page *page,
static int cifs_readpage_worker(struct file *file, struct page *page,
	loff_t *poffset)
	loff_t *poffset)
{
{
@@ -3390,7 +3393,6 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
	if (rc == 0)
	if (rc == 0)
		goto read_complete;
		goto read_complete;


	page_cache_get(page);
	read_data = kmap(page);
	read_data = kmap(page);
	/* for reads over a certain size could initiate async read ahead */
	/* for reads over a certain size could initiate async read ahead */


@@ -3417,7 +3419,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,


io_error:
io_error:
	kunmap(page);
	kunmap(page);
	page_cache_release(page);
	unlock_page(page);


read_complete:
read_complete:
	return rc;
	return rc;
@@ -3442,8 +3444,6 @@ static int cifs_readpage(struct file *file, struct page *page)


	rc = cifs_readpage_worker(file, page, &offset);
	rc = cifs_readpage_worker(file, page, &offset);


	unlock_page(page);

	free_xid(xid);
	free_xid(xid);
	return rc;
	return rc;
}
}
@@ -3497,6 +3497,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned flags,
			loff_t pos, unsigned len, unsigned flags,
			struct page **pagep, void **fsdata)
			struct page **pagep, void **fsdata)
{
{
	int oncethru = 0;
	pgoff_t index = pos >> PAGE_CACHE_SHIFT;
	pgoff_t index = pos >> PAGE_CACHE_SHIFT;
	loff_t offset = pos & (PAGE_CACHE_SIZE - 1);
	loff_t offset = pos & (PAGE_CACHE_SIZE - 1);
	loff_t page_start = pos & PAGE_MASK;
	loff_t page_start = pos & PAGE_MASK;
@@ -3506,6 +3507,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,


	cifs_dbg(FYI, "write_begin from %lld len %d\n", (long long)pos, len);
	cifs_dbg(FYI, "write_begin from %lld len %d\n", (long long)pos, len);


start:
	page = grab_cache_page_write_begin(mapping, index, flags);
	page = grab_cache_page_write_begin(mapping, index, flags);
	if (!page) {
	if (!page) {
		rc = -ENOMEM;
		rc = -ENOMEM;
@@ -3547,13 +3549,16 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
		}
		}
	}
	}


	if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
	if ((file->f_flags & O_ACCMODE) != O_WRONLY && !oncethru) {
		/*
		/*
		 * might as well read a page, it is fast enough. If we get
		 * 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
		 * an error, we don't need to return it. cifs_write_end will
		 * do a sync write instead since PG_uptodate isn't set.
		 * do a sync write instead since PG_uptodate isn't set.
		 */
		 */
		cifs_readpage_worker(file, page, &page_start);
		cifs_readpage_worker(file, page, &page_start);
		page_cache_release(page);
		oncethru = 1;
		goto start;
	} else {
	} else {
		/* we could try using another file handle if there is one -
		/* we could try using another file handle if there is one -
		   but how would we lock it to prevent close of that handle
		   but how would we lock it to prevent close of that handle