Skip to content

Commit 3369d11

Browse files
committed
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()
2 parents f1da345 + 81b6622 commit 3369d11

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed
Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
This is the client VFS module for the Common Internet File System
22
(CIFS) protocol which is the successor to the Server Message Block
33
(SMB) protocol, the native file sharing mechanism for most early
4-
PC operating systems. CIFS is fully supported by current network
5-
file servers such as Windows 2000, Windows 2003 (including
6-
Windows XP) as well by Samba (which provides excellent CIFS
4+
PC operating systems. New and improved versions of CIFS are now
5+
called SMB2 and SMB3. These dialects are also supported by the
6+
CIFS VFS module. CIFS is fully supported by network
7+
file servers such as Windows 2000, 2003, 2008 and 2012
8+
as well by Samba (which provides excellent CIFS
79
server support for Linux and many other operating systems), so
810
this network filesystem client can mount to a wide variety of
9-
servers. The smbfs module should be used instead of this cifs module
10-
for mounting to older SMB servers such as OS/2. The smbfs and cifs
11-
modules can coexist and do not conflict. The CIFS VFS filesystem
12-
module is designed to work well with servers that implement the
13-
newer versions (dialects) of the SMB/CIFS protocol such as Samba,
14-
the program written by Andrew Tridgell that turns any Unix host
15-
into a SMB/CIFS file server.
11+
servers.
1612

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

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

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

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

29+
For more information on the module see the project wiki page at
4030

41-
For more information on the module see the project page at
42-
43-
http://us1.samba.org/samba/Linux_CIFS_client.html
44-
45-
For more information on CIFS see:
46-
47-
http://www.snia.org/tech_activities/CIFS
48-
49-
or the Samba site:
50-
51-
http://www.samba.org
31+
https://wiki.samba.org/index.php/LinuxCIFS_utils

fs/cifs/file.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,6 +3379,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
33793379
return rc;
33803380
}
33813381

3382+
/*
3383+
* cifs_readpage_worker must be called with the page pinned
3384+
*/
33823385
static int cifs_readpage_worker(struct file *file, struct page *page,
33833386
loff_t *poffset)
33843387
{
@@ -3390,7 +3393,6 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
33903393
if (rc == 0)
33913394
goto read_complete;
33923395

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

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

34183420
io_error:
34193421
kunmap(page);
3420-
page_cache_release(page);
3422+
unlock_page(page);
34213423

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

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

3445-
unlock_page(page);
3446-
34473447
free_xid(xid);
34483448
return rc;
34493449
}
@@ -3497,6 +3497,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
34973497
loff_t pos, unsigned len, unsigned flags,
34983498
struct page **pagep, void **fsdata)
34993499
{
3500+
int oncethru = 0;
35003501
pgoff_t index = pos >> PAGE_CACHE_SHIFT;
35013502
loff_t offset = pos & (PAGE_CACHE_SIZE - 1);
35023503
loff_t page_start = pos & PAGE_MASK;
@@ -3506,6 +3507,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
35063507

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

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

3550-
if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
3552+
if ((file->f_flags & O_ACCMODE) != O_WRONLY && !oncethru) {
35513553
/*
35523554
* might as well read a page, it is fast enough. If we get
35533555
* an error, we don't need to return it. cifs_write_end will
35543556
* do a sync write instead since PG_uptodate isn't set.
35553557
*/
35563558
cifs_readpage_worker(file, page, &page_start);
3559+
page_cache_release(page);
3560+
oncethru = 1;
3561+
goto start;
35573562
} else {
35583563
/* we could try using another file handle if there is one -
35593564
but how would we lock it to prevent close of that handle

0 commit comments

Comments
 (0)