diff options
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 222 |
1 files changed, 107 insertions, 115 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 9b11a8f56f3a..a83541ec9713 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * vfs operations that deal with files | 4 | * vfs operations that deal with files |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2002,2007 | 6 | * Copyright (C) International Business Machines Corp., 2002,2010 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * Jeremy Allison (jra@samba.org) | 8 | * Jeremy Allison (jra@samba.org) |
9 | * | 9 | * |
@@ -108,8 +108,7 @@ static inline int cifs_get_disposition(unsigned int flags) | |||
108 | /* all arguments to this function must be checked for validity in caller */ | 108 | /* all arguments to this function must be checked for validity in caller */ |
109 | static inline int | 109 | static inline int |
110 | cifs_posix_open_inode_helper(struct inode *inode, struct file *file, | 110 | cifs_posix_open_inode_helper(struct inode *inode, struct file *file, |
111 | struct cifsInodeInfo *pCifsInode, | 111 | struct cifsInodeInfo *pCifsInode, __u32 oplock, |
112 | struct cifsFileInfo *pCifsFile, __u32 oplock, | ||
113 | u16 netfid) | 112 | u16 netfid) |
114 | { | 113 | { |
115 | 114 | ||
@@ -136,15 +135,15 @@ cifs_posix_open_inode_helper(struct inode *inode, struct file *file, | |||
136 | if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && | 135 | if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && |
137 | (file->f_path.dentry->d_inode->i_size == | 136 | (file->f_path.dentry->d_inode->i_size == |
138 | (loff_t)le64_to_cpu(buf->EndOfFile))) { | 137 | (loff_t)le64_to_cpu(buf->EndOfFile))) { |
139 | cFYI(1, ("inode unchanged on server")); | 138 | cFYI(1, "inode unchanged on server"); |
140 | } else { | 139 | } else { |
141 | if (file->f_path.dentry->d_inode->i_mapping) { | 140 | if (file->f_path.dentry->d_inode->i_mapping) { |
142 | rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); | 141 | rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); |
143 | if (rc != 0) | 142 | if (rc != 0) |
144 | CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; | 143 | CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; |
145 | } | 144 | } |
146 | cFYI(1, ("invalidating remote inode since open detected it " | 145 | cFYI(1, "invalidating remote inode since open detected it " |
147 | "changed")); | 146 | "changed"); |
148 | invalidate_remote_inode(file->f_path.dentry->d_inode); | 147 | invalidate_remote_inode(file->f_path.dentry->d_inode); |
149 | } */ | 148 | } */ |
150 | 149 | ||
@@ -152,8 +151,8 @@ psx_client_can_cache: | |||
152 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 151 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
153 | pCifsInode->clientCanCacheAll = true; | 152 | pCifsInode->clientCanCacheAll = true; |
154 | pCifsInode->clientCanCacheRead = true; | 153 | pCifsInode->clientCanCacheRead = true; |
155 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 154 | cFYI(1, "Exclusive Oplock granted on inode %p", |
156 | file->f_path.dentry->d_inode)); | 155 | file->f_path.dentry->d_inode); |
157 | } else if ((oplock & 0xF) == OPLOCK_READ) | 156 | } else if ((oplock & 0xF) == OPLOCK_READ) |
158 | pCifsInode->clientCanCacheRead = true; | 157 | pCifsInode->clientCanCacheRead = true; |
159 | 158 | ||
@@ -190,8 +189,8 @@ cifs_fill_filedata(struct file *file) | |||
190 | if (file->private_data != NULL) { | 189 | if (file->private_data != NULL) { |
191 | return pCifsFile; | 190 | return pCifsFile; |
192 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) | 191 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) |
193 | cERROR(1, ("could not find file instance for " | 192 | cERROR(1, "could not find file instance for " |
194 | "new file %p", file)); | 193 | "new file %p", file); |
195 | return NULL; | 194 | return NULL; |
196 | } | 195 | } |
197 | 196 | ||
@@ -217,7 +216,7 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | |||
217 | if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && | 216 | if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && |
218 | (file->f_path.dentry->d_inode->i_size == | 217 | (file->f_path.dentry->d_inode->i_size == |
219 | (loff_t)le64_to_cpu(buf->EndOfFile))) { | 218 | (loff_t)le64_to_cpu(buf->EndOfFile))) { |
220 | cFYI(1, ("inode unchanged on server")); | 219 | cFYI(1, "inode unchanged on server"); |
221 | } else { | 220 | } else { |
222 | if (file->f_path.dentry->d_inode->i_mapping) { | 221 | if (file->f_path.dentry->d_inode->i_mapping) { |
223 | /* BB no need to lock inode until after invalidate | 222 | /* BB no need to lock inode until after invalidate |
@@ -226,8 +225,8 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | |||
226 | if (rc != 0) | 225 | if (rc != 0) |
227 | CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; | 226 | CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; |
228 | } | 227 | } |
229 | cFYI(1, ("invalidating remote inode since open detected it " | 228 | cFYI(1, "invalidating remote inode since open detected it " |
230 | "changed")); | 229 | "changed"); |
231 | invalidate_remote_inode(file->f_path.dentry->d_inode); | 230 | invalidate_remote_inode(file->f_path.dentry->d_inode); |
232 | } | 231 | } |
233 | 232 | ||
@@ -242,8 +241,8 @@ client_can_cache: | |||
242 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 241 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
243 | pCifsInode->clientCanCacheAll = true; | 242 | pCifsInode->clientCanCacheAll = true; |
244 | pCifsInode->clientCanCacheRead = true; | 243 | pCifsInode->clientCanCacheRead = true; |
245 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 244 | cFYI(1, "Exclusive Oplock granted on inode %p", |
246 | file->f_path.dentry->d_inode)); | 245 | file->f_path.dentry->d_inode); |
247 | } else if ((*oplock & 0xF) == OPLOCK_READ) | 246 | } else if ((*oplock & 0xF) == OPLOCK_READ) |
248 | pCifsInode->clientCanCacheRead = true; | 247 | pCifsInode->clientCanCacheRead = true; |
249 | 248 | ||
@@ -285,8 +284,8 @@ int cifs_open(struct inode *inode, struct file *file) | |||
285 | return rc; | 284 | return rc; |
286 | } | 285 | } |
287 | 286 | ||
288 | cFYI(1, ("inode = 0x%p file flags are 0x%x for %s", | 287 | cFYI(1, "inode = 0x%p file flags are 0x%x for %s", |
289 | inode, file->f_flags, full_path)); | 288 | inode, file->f_flags, full_path); |
290 | 289 | ||
291 | if (oplockEnabled) | 290 | if (oplockEnabled) |
292 | oplock = REQ_OPLOCK; | 291 | oplock = REQ_OPLOCK; |
@@ -298,27 +297,29 @@ int cifs_open(struct inode *inode, struct file *file) | |||
298 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 297 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
299 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | 298 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { |
300 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); | 299 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); |
300 | oflags |= SMB_O_CREAT; | ||
301 | /* can not refresh inode info since size could be stale */ | 301 | /* can not refresh inode info since size could be stale */ |
302 | rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, | 302 | rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, |
303 | cifs_sb->mnt_file_mode /* ignored */, | 303 | inode->i_sb, |
304 | oflags, &oplock, &netfid, xid); | 304 | cifs_sb->mnt_file_mode /* ignored */, |
305 | oflags, &oplock, &netfid, xid); | ||
305 | if (rc == 0) { | 306 | if (rc == 0) { |
306 | cFYI(1, ("posix open succeeded")); | 307 | cFYI(1, "posix open succeeded"); |
307 | /* no need for special case handling of setting mode | 308 | /* no need for special case handling of setting mode |
308 | on read only files needed here */ | 309 | on read only files needed here */ |
309 | 310 | ||
310 | pCifsFile = cifs_fill_filedata(file); | 311 | pCifsFile = cifs_fill_filedata(file); |
311 | cifs_posix_open_inode_helper(inode, file, pCifsInode, | 312 | cifs_posix_open_inode_helper(inode, file, pCifsInode, |
312 | pCifsFile, oplock, netfid); | 313 | oplock, netfid); |
313 | goto out; | 314 | goto out; |
314 | } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 315 | } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
315 | if (tcon->ses->serverNOS) | 316 | if (tcon->ses->serverNOS) |
316 | cERROR(1, ("server %s of type %s returned" | 317 | cERROR(1, "server %s of type %s returned" |
317 | " unexpected error on SMB posix open" | 318 | " unexpected error on SMB posix open" |
318 | ", disabling posix open support." | 319 | ", disabling posix open support." |
319 | " Check if server update available.", | 320 | " Check if server update available.", |
320 | tcon->ses->serverName, | 321 | tcon->ses->serverName, |
321 | tcon->ses->serverNOS)); | 322 | tcon->ses->serverNOS); |
322 | tcon->broken_posix_open = true; | 323 | tcon->broken_posix_open = true; |
323 | } else if ((rc != -EIO) && (rc != -EREMOTE) && | 324 | } else if ((rc != -EIO) && (rc != -EREMOTE) && |
324 | (rc != -EOPNOTSUPP)) /* path not found or net err */ | 325 | (rc != -EOPNOTSUPP)) /* path not found or net err */ |
@@ -386,7 +387,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
386 | & CIFS_MOUNT_MAP_SPECIAL_CHR); | 387 | & CIFS_MOUNT_MAP_SPECIAL_CHR); |
387 | } | 388 | } |
388 | if (rc) { | 389 | if (rc) { |
389 | cFYI(1, ("cifs_open returned 0x%x", rc)); | 390 | cFYI(1, "cifs_open returned 0x%x", rc); |
390 | goto out; | 391 | goto out; |
391 | } | 392 | } |
392 | 393 | ||
@@ -469,7 +470,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush) | |||
469 | } | 470 | } |
470 | 471 | ||
471 | if (file->f_path.dentry == NULL) { | 472 | if (file->f_path.dentry == NULL) { |
472 | cERROR(1, ("no valid name if dentry freed")); | 473 | cERROR(1, "no valid name if dentry freed"); |
473 | dump_stack(); | 474 | dump_stack(); |
474 | rc = -EBADF; | 475 | rc = -EBADF; |
475 | goto reopen_error_exit; | 476 | goto reopen_error_exit; |
@@ -477,7 +478,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush) | |||
477 | 478 | ||
478 | inode = file->f_path.dentry->d_inode; | 479 | inode = file->f_path.dentry->d_inode; |
479 | if (inode == NULL) { | 480 | if (inode == NULL) { |
480 | cERROR(1, ("inode not valid")); | 481 | cERROR(1, "inode not valid"); |
481 | dump_stack(); | 482 | dump_stack(); |
482 | rc = -EBADF; | 483 | rc = -EBADF; |
483 | goto reopen_error_exit; | 484 | goto reopen_error_exit; |
@@ -499,8 +500,8 @@ reopen_error_exit: | |||
499 | return rc; | 500 | return rc; |
500 | } | 501 | } |
501 | 502 | ||
502 | cFYI(1, ("inode = 0x%p file flags 0x%x for %s", | 503 | cFYI(1, "inode = 0x%p file flags 0x%x for %s", |
503 | inode, file->f_flags, full_path)); | 504 | inode, file->f_flags, full_path); |
504 | 505 | ||
505 | if (oplockEnabled) | 506 | if (oplockEnabled) |
506 | oplock = REQ_OPLOCK; | 507 | oplock = REQ_OPLOCK; |
@@ -513,10 +514,11 @@ reopen_error_exit: | |||
513 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); | 514 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); |
514 | /* can not refresh inode info since size could be stale */ | 515 | /* can not refresh inode info since size could be stale */ |
515 | rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, | 516 | rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, |
516 | cifs_sb->mnt_file_mode /* ignored */, | 517 | inode->i_sb, |
517 | oflags, &oplock, &netfid, xid); | 518 | cifs_sb->mnt_file_mode /* ignored */, |
519 | oflags, &oplock, &netfid, xid); | ||
518 | if (rc == 0) { | 520 | if (rc == 0) { |
519 | cFYI(1, ("posix reopen succeeded")); | 521 | cFYI(1, "posix reopen succeeded"); |
520 | goto reopen_success; | 522 | goto reopen_success; |
521 | } | 523 | } |
522 | /* fallthrough to retry open the old way on errors, especially | 524 | /* fallthrough to retry open the old way on errors, especially |
@@ -537,8 +539,8 @@ reopen_error_exit: | |||
537 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 539 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
538 | if (rc) { | 540 | if (rc) { |
539 | mutex_unlock(&pCifsFile->fh_mutex); | 541 | mutex_unlock(&pCifsFile->fh_mutex); |
540 | cFYI(1, ("cifs_open returned 0x%x", rc)); | 542 | cFYI(1, "cifs_open returned 0x%x", rc); |
541 | cFYI(1, ("oplock: %d", oplock)); | 543 | cFYI(1, "oplock: %d", oplock); |
542 | } else { | 544 | } else { |
543 | reopen_success: | 545 | reopen_success: |
544 | pCifsFile->netfid = netfid; | 546 | pCifsFile->netfid = netfid; |
@@ -570,8 +572,8 @@ reopen_success: | |||
570 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 572 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
571 | pCifsInode->clientCanCacheAll = true; | 573 | pCifsInode->clientCanCacheAll = true; |
572 | pCifsInode->clientCanCacheRead = true; | 574 | pCifsInode->clientCanCacheRead = true; |
573 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 575 | cFYI(1, "Exclusive Oplock granted on inode %p", |
574 | file->f_path.dentry->d_inode)); | 576 | file->f_path.dentry->d_inode); |
575 | } else if ((oplock & 0xF) == OPLOCK_READ) { | 577 | } else if ((oplock & 0xF) == OPLOCK_READ) { |
576 | pCifsInode->clientCanCacheRead = true; | 578 | pCifsInode->clientCanCacheRead = true; |
577 | pCifsInode->clientCanCacheAll = false; | 579 | pCifsInode->clientCanCacheAll = false; |
@@ -619,8 +621,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
619 | the struct would be in each open file, | 621 | the struct would be in each open file, |
620 | but this should give enough time to | 622 | but this should give enough time to |
621 | clear the socket */ | 623 | clear the socket */ |
622 | cFYI(DBG2, | 624 | cFYI(DBG2, "close delay, write pending"); |
623 | ("close delay, write pending")); | ||
624 | msleep(timeout); | 625 | msleep(timeout); |
625 | timeout *= 4; | 626 | timeout *= 4; |
626 | } | 627 | } |
@@ -653,7 +654,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
653 | 654 | ||
654 | read_lock(&GlobalSMBSeslock); | 655 | read_lock(&GlobalSMBSeslock); |
655 | if (list_empty(&(CIFS_I(inode)->openFileList))) { | 656 | if (list_empty(&(CIFS_I(inode)->openFileList))) { |
656 | cFYI(1, ("closing last open instance for inode %p", inode)); | 657 | cFYI(1, "closing last open instance for inode %p", inode); |
657 | /* if the file is not open we do not know if we can cache info | 658 | /* if the file is not open we do not know if we can cache info |
658 | on this inode, much less write behind and read ahead */ | 659 | on this inode, much less write behind and read ahead */ |
659 | CIFS_I(inode)->clientCanCacheRead = false; | 660 | CIFS_I(inode)->clientCanCacheRead = false; |
@@ -674,7 +675,7 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
674 | (struct cifsFileInfo *)file->private_data; | 675 | (struct cifsFileInfo *)file->private_data; |
675 | char *ptmp; | 676 | char *ptmp; |
676 | 677 | ||
677 | cFYI(1, ("Closedir inode = 0x%p", inode)); | 678 | cFYI(1, "Closedir inode = 0x%p", inode); |
678 | 679 | ||
679 | xid = GetXid(); | 680 | xid = GetXid(); |
680 | 681 | ||
@@ -685,22 +686,22 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
685 | 686 | ||
686 | pTcon = cifs_sb->tcon; | 687 | pTcon = cifs_sb->tcon; |
687 | 688 | ||
688 | cFYI(1, ("Freeing private data in close dir")); | 689 | cFYI(1, "Freeing private data in close dir"); |
689 | write_lock(&GlobalSMBSeslock); | 690 | write_lock(&GlobalSMBSeslock); |
690 | if (!pCFileStruct->srch_inf.endOfSearch && | 691 | if (!pCFileStruct->srch_inf.endOfSearch && |
691 | !pCFileStruct->invalidHandle) { | 692 | !pCFileStruct->invalidHandle) { |
692 | pCFileStruct->invalidHandle = true; | 693 | pCFileStruct->invalidHandle = true; |
693 | write_unlock(&GlobalSMBSeslock); | 694 | write_unlock(&GlobalSMBSeslock); |
694 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); | 695 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); |
695 | cFYI(1, ("Closing uncompleted readdir with rc %d", | 696 | cFYI(1, "Closing uncompleted readdir with rc %d", |
696 | rc)); | 697 | rc); |
697 | /* not much we can do if it fails anyway, ignore rc */ | 698 | /* not much we can do if it fails anyway, ignore rc */ |
698 | rc = 0; | 699 | rc = 0; |
699 | } else | 700 | } else |
700 | write_unlock(&GlobalSMBSeslock); | 701 | write_unlock(&GlobalSMBSeslock); |
701 | ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; | 702 | ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; |
702 | if (ptmp) { | 703 | if (ptmp) { |
703 | cFYI(1, ("closedir free smb buf in srch struct")); | 704 | cFYI(1, "closedir free smb buf in srch struct"); |
704 | pCFileStruct->srch_inf.ntwrk_buf_start = NULL; | 705 | pCFileStruct->srch_inf.ntwrk_buf_start = NULL; |
705 | if (pCFileStruct->srch_inf.smallBuf) | 706 | if (pCFileStruct->srch_inf.smallBuf) |
706 | cifs_small_buf_release(ptmp); | 707 | cifs_small_buf_release(ptmp); |
@@ -748,49 +749,49 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
748 | rc = -EACCES; | 749 | rc = -EACCES; |
749 | xid = GetXid(); | 750 | xid = GetXid(); |
750 | 751 | ||
751 | cFYI(1, ("Lock parm: 0x%x flockflags: " | 752 | cFYI(1, "Lock parm: 0x%x flockflags: " |
752 | "0x%x flocktype: 0x%x start: %lld end: %lld", | 753 | "0x%x flocktype: 0x%x start: %lld end: %lld", |
753 | cmd, pfLock->fl_flags, pfLock->fl_type, pfLock->fl_start, | 754 | cmd, pfLock->fl_flags, pfLock->fl_type, pfLock->fl_start, |
754 | pfLock->fl_end)); | 755 | pfLock->fl_end); |
755 | 756 | ||
756 | if (pfLock->fl_flags & FL_POSIX) | 757 | if (pfLock->fl_flags & FL_POSIX) |
757 | cFYI(1, ("Posix")); | 758 | cFYI(1, "Posix"); |
758 | if (pfLock->fl_flags & FL_FLOCK) | 759 | if (pfLock->fl_flags & FL_FLOCK) |
759 | cFYI(1, ("Flock")); | 760 | cFYI(1, "Flock"); |
760 | if (pfLock->fl_flags & FL_SLEEP) { | 761 | if (pfLock->fl_flags & FL_SLEEP) { |
761 | cFYI(1, ("Blocking lock")); | 762 | cFYI(1, "Blocking lock"); |
762 | wait_flag = true; | 763 | wait_flag = true; |
763 | } | 764 | } |
764 | if (pfLock->fl_flags & FL_ACCESS) | 765 | if (pfLock->fl_flags & FL_ACCESS) |
765 | cFYI(1, ("Process suspended by mandatory locking - " | 766 | cFYI(1, "Process suspended by mandatory locking - " |
766 | "not implemented yet")); | 767 | "not implemented yet"); |
767 | if (pfLock->fl_flags & FL_LEASE) | 768 | if (pfLock->fl_flags & FL_LEASE) |
768 | cFYI(1, ("Lease on file - not implemented yet")); | 769 | cFYI(1, "Lease on file - not implemented yet"); |
769 | if (pfLock->fl_flags & | 770 | if (pfLock->fl_flags & |
770 | (~(FL_POSIX | FL_FLOCK | FL_SLEEP | FL_ACCESS | FL_LEASE))) | 771 | (~(FL_POSIX | FL_FLOCK | FL_SLEEP | FL_ACCESS | FL_LEASE))) |
771 | cFYI(1, ("Unknown lock flags 0x%x", pfLock->fl_flags)); | 772 | cFYI(1, "Unknown lock flags 0x%x", pfLock->fl_flags); |
772 | 773 | ||
773 | if (pfLock->fl_type == F_WRLCK) { | 774 | if (pfLock->fl_type == F_WRLCK) { |
774 | cFYI(1, ("F_WRLCK ")); | 775 | cFYI(1, "F_WRLCK "); |
775 | numLock = 1; | 776 | numLock = 1; |
776 | } else if (pfLock->fl_type == F_UNLCK) { | 777 | } else if (pfLock->fl_type == F_UNLCK) { |
777 | cFYI(1, ("F_UNLCK")); | 778 | cFYI(1, "F_UNLCK"); |
778 | numUnlock = 1; | 779 | numUnlock = 1; |
779 | /* Check if unlock includes more than | 780 | /* Check if unlock includes more than |
780 | one lock range */ | 781 | one lock range */ |
781 | } else if (pfLock->fl_type == F_RDLCK) { | 782 | } else if (pfLock->fl_type == F_RDLCK) { |
782 | cFYI(1, ("F_RDLCK")); | 783 | cFYI(1, "F_RDLCK"); |
783 | lockType |= LOCKING_ANDX_SHARED_LOCK; | 784 | lockType |= LOCKING_ANDX_SHARED_LOCK; |
784 | numLock = 1; | 785 | numLock = 1; |
785 | } else if (pfLock->fl_type == F_EXLCK) { | 786 | } else if (pfLock->fl_type == F_EXLCK) { |
786 | cFYI(1, ("F_EXLCK")); | 787 | cFYI(1, "F_EXLCK"); |
787 | numLock = 1; | 788 | numLock = 1; |
788 | } else if (pfLock->fl_type == F_SHLCK) { | 789 | } else if (pfLock->fl_type == F_SHLCK) { |
789 | cFYI(1, ("F_SHLCK")); | 790 | cFYI(1, "F_SHLCK"); |
790 | lockType |= LOCKING_ANDX_SHARED_LOCK; | 791 | lockType |= LOCKING_ANDX_SHARED_LOCK; |
791 | numLock = 1; | 792 | numLock = 1; |
792 | } else | 793 | } else |
793 | cFYI(1, ("Unknown type of lock")); | 794 | cFYI(1, "Unknown type of lock"); |
794 | 795 | ||
795 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 796 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
796 | tcon = cifs_sb->tcon; | 797 | tcon = cifs_sb->tcon; |
@@ -833,8 +834,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
833 | 0 /* wait flag */ ); | 834 | 0 /* wait flag */ ); |
834 | pfLock->fl_type = F_UNLCK; | 835 | pfLock->fl_type = F_UNLCK; |
835 | if (rc != 0) | 836 | if (rc != 0) |
836 | cERROR(1, ("Error unlocking previously locked " | 837 | cERROR(1, "Error unlocking previously locked " |
837 | "range %d during test of lock", rc)); | 838 | "range %d during test of lock", rc); |
838 | rc = 0; | 839 | rc = 0; |
839 | 840 | ||
840 | } else { | 841 | } else { |
@@ -856,9 +857,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
856 | 0 /* wait flag */); | 857 | 0 /* wait flag */); |
857 | pfLock->fl_type = F_RDLCK; | 858 | pfLock->fl_type = F_RDLCK; |
858 | if (rc != 0) | 859 | if (rc != 0) |
859 | cERROR(1, ("Error unlocking " | 860 | cERROR(1, "Error unlocking " |
860 | "previously locked range %d " | 861 | "previously locked range %d " |
861 | "during test of lock", rc)); | 862 | "during test of lock", rc); |
862 | rc = 0; | 863 | rc = 0; |
863 | } else { | 864 | } else { |
864 | pfLock->fl_type = F_WRLCK; | 865 | pfLock->fl_type = F_WRLCK; |
@@ -923,9 +924,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
923 | 1, 0, li->type, false); | 924 | 1, 0, li->type, false); |
924 | if (stored_rc) | 925 | if (stored_rc) |
925 | rc = stored_rc; | 926 | rc = stored_rc; |
926 | 927 | else { | |
927 | list_del(&li->llist); | 928 | list_del(&li->llist); |
928 | kfree(li); | 929 | kfree(li); |
930 | } | ||
929 | } | 931 | } |
930 | } | 932 | } |
931 | mutex_unlock(&fid->lock_mutex); | 933 | mutex_unlock(&fid->lock_mutex); |
@@ -988,9 +990,8 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
988 | 990 | ||
989 | pTcon = cifs_sb->tcon; | 991 | pTcon = cifs_sb->tcon; |
990 | 992 | ||
991 | /* cFYI(1, | 993 | /* cFYI(1, " write %d bytes to offset %lld of %s", write_size, |
992 | (" write %d bytes to offset %lld of %s", write_size, | 994 | *poffset, file->f_path.dentry->d_name.name); */ |
993 | *poffset, file->f_path.dentry->d_name.name)); */ | ||
994 | 995 | ||
995 | if (file->private_data == NULL) | 996 | if (file->private_data == NULL) |
996 | return -EBADF; | 997 | return -EBADF; |
@@ -1091,8 +1092,8 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
1091 | 1092 | ||
1092 | pTcon = cifs_sb->tcon; | 1093 | pTcon = cifs_sb->tcon; |
1093 | 1094 | ||
1094 | cFYI(1, ("write %zd bytes to offset %lld of %s", write_size, | 1095 | cFYI(1, "write %zd bytes to offset %lld of %s", write_size, |
1095 | *poffset, file->f_path.dentry->d_name.name)); | 1096 | *poffset, file->f_path.dentry->d_name.name); |
1096 | 1097 | ||
1097 | if (file->private_data == NULL) | 1098 | if (file->private_data == NULL) |
1098 | return -EBADF; | 1099 | return -EBADF; |
@@ -1233,7 +1234,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) | |||
1233 | it being zero) during stress testcases so we need to check for it */ | 1234 | it being zero) during stress testcases so we need to check for it */ |
1234 | 1235 | ||
1235 | if (cifs_inode == NULL) { | 1236 | if (cifs_inode == NULL) { |
1236 | cERROR(1, ("Null inode passed to cifs_writeable_file")); | 1237 | cERROR(1, "Null inode passed to cifs_writeable_file"); |
1237 | dump_stack(); | 1238 | dump_stack(); |
1238 | return NULL; | 1239 | return NULL; |
1239 | } | 1240 | } |
@@ -1277,7 +1278,7 @@ refind_writable: | |||
1277 | again. Note that it would be bad | 1278 | again. Note that it would be bad |
1278 | to hold up writepages here (rather than | 1279 | to hold up writepages here (rather than |
1279 | in caller) with continuous retries */ | 1280 | in caller) with continuous retries */ |
1280 | cFYI(1, ("wp failed on reopen file")); | 1281 | cFYI(1, "wp failed on reopen file"); |
1281 | read_lock(&GlobalSMBSeslock); | 1282 | read_lock(&GlobalSMBSeslock); |
1282 | /* can not use this handle, no write | 1283 | /* can not use this handle, no write |
1283 | pending on this one after all */ | 1284 | pending on this one after all */ |
@@ -1353,7 +1354,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) | |||
1353 | else if (bytes_written < 0) | 1354 | else if (bytes_written < 0) |
1354 | rc = bytes_written; | 1355 | rc = bytes_written; |
1355 | } else { | 1356 | } else { |
1356 | cFYI(1, ("No writeable filehandles for inode")); | 1357 | cFYI(1, "No writeable filehandles for inode"); |
1357 | rc = -EIO; | 1358 | rc = -EIO; |
1358 | } | 1359 | } |
1359 | 1360 | ||
@@ -1525,7 +1526,7 @@ retry: | |||
1525 | */ | 1526 | */ |
1526 | open_file = find_writable_file(CIFS_I(mapping->host)); | 1527 | open_file = find_writable_file(CIFS_I(mapping->host)); |
1527 | if (!open_file) { | 1528 | if (!open_file) { |
1528 | cERROR(1, ("No writable handles for inode")); | 1529 | cERROR(1, "No writable handles for inode"); |
1529 | rc = -EBADF; | 1530 | rc = -EBADF; |
1530 | } else { | 1531 | } else { |
1531 | long_op = cifs_write_timeout(cifsi, offset); | 1532 | long_op = cifs_write_timeout(cifsi, offset); |
@@ -1538,8 +1539,8 @@ retry: | |||
1538 | cifs_update_eof(cifsi, offset, bytes_written); | 1539 | cifs_update_eof(cifsi, offset, bytes_written); |
1539 | 1540 | ||
1540 | if (rc || bytes_written < bytes_to_write) { | 1541 | if (rc || bytes_written < bytes_to_write) { |
1541 | cERROR(1, ("Write2 ret %d, wrote %d", | 1542 | cERROR(1, "Write2 ret %d, wrote %d", |
1542 | rc, bytes_written)); | 1543 | rc, bytes_written); |
1543 | /* BB what if continued retry is | 1544 | /* BB what if continued retry is |
1544 | requested via mount flags? */ | 1545 | requested via mount flags? */ |
1545 | if (rc == -ENOSPC) | 1546 | if (rc == -ENOSPC) |
@@ -1600,7 +1601,7 @@ static int cifs_writepage(struct page *page, struct writeback_control *wbc) | |||
1600 | /* BB add check for wbc flags */ | 1601 | /* BB add check for wbc flags */ |
1601 | page_cache_get(page); | 1602 | page_cache_get(page); |
1602 | if (!PageUptodate(page)) | 1603 | if (!PageUptodate(page)) |
1603 | cFYI(1, ("ppw - page not up to date")); | 1604 | cFYI(1, "ppw - page not up to date"); |
1604 | 1605 | ||
1605 | /* | 1606 | /* |
1606 | * Set the "writeback" flag, and clear "dirty" in the radix tree. | 1607 | * Set the "writeback" flag, and clear "dirty" in the radix tree. |
@@ -1629,8 +1630,8 @@ static int cifs_write_end(struct file *file, struct address_space *mapping, | |||
1629 | int rc; | 1630 | int rc; |
1630 | struct inode *inode = mapping->host; | 1631 | struct inode *inode = mapping->host; |
1631 | 1632 | ||
1632 | cFYI(1, ("write_end for page %p from pos %lld with %d bytes", | 1633 | cFYI(1, "write_end for page %p from pos %lld with %d bytes", |
1633 | page, pos, copied)); | 1634 | page, pos, copied); |
1634 | 1635 | ||
1635 | if (PageChecked(page)) { | 1636 | if (PageChecked(page)) { |
1636 | if (copied == len) | 1637 | if (copied == len) |
@@ -1686,8 +1687,8 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1686 | 1687 | ||
1687 | xid = GetXid(); | 1688 | xid = GetXid(); |
1688 | 1689 | ||
1689 | cFYI(1, ("Sync file - name: %s datasync: 0x%x", | 1690 | cFYI(1, "Sync file - name: %s datasync: 0x%x", |
1690 | dentry->d_name.name, datasync)); | 1691 | dentry->d_name.name, datasync); |
1691 | 1692 | ||
1692 | rc = filemap_write_and_wait(inode->i_mapping); | 1693 | rc = filemap_write_and_wait(inode->i_mapping); |
1693 | if (rc == 0) { | 1694 | if (rc == 0) { |
@@ -1711,7 +1712,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1711 | unsigned int rpages = 0; | 1712 | unsigned int rpages = 0; |
1712 | int rc = 0; | 1713 | int rc = 0; |
1713 | 1714 | ||
1714 | cFYI(1, ("sync page %p",page)); | 1715 | cFYI(1, "sync page %p", page); |
1715 | mapping = page->mapping; | 1716 | mapping = page->mapping; |
1716 | if (!mapping) | 1717 | if (!mapping) |
1717 | return 0; | 1718 | return 0; |
@@ -1722,7 +1723,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1722 | /* fill in rpages then | 1723 | /* fill in rpages then |
1723 | result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */ | 1724 | result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */ |
1724 | 1725 | ||
1725 | /* cFYI(1, ("rpages is %d for sync page of Index %ld", rpages, index)); | 1726 | /* cFYI(1, "rpages is %d for sync page of Index %ld", rpages, index); |
1726 | 1727 | ||
1727 | #if 0 | 1728 | #if 0 |
1728 | if (rc < 0) | 1729 | if (rc < 0) |
@@ -1756,7 +1757,7 @@ int cifs_flush(struct file *file, fl_owner_t id) | |||
1756 | CIFS_I(inode)->write_behind_rc = 0; | 1757 | CIFS_I(inode)->write_behind_rc = 0; |
1757 | } | 1758 | } |
1758 | 1759 | ||
1759 | cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc)); | 1760 | cFYI(1, "Flush inode %p file %p rc %d", inode, file, rc); |
1760 | 1761 | ||
1761 | return rc; | 1762 | return rc; |
1762 | } | 1763 | } |
@@ -1788,7 +1789,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1788 | open_file = (struct cifsFileInfo *)file->private_data; | 1789 | open_file = (struct cifsFileInfo *)file->private_data; |
1789 | 1790 | ||
1790 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) | 1791 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) |
1791 | cFYI(1, ("attempting read on write only file instance")); | 1792 | cFYI(1, "attempting read on write only file instance"); |
1792 | 1793 | ||
1793 | for (total_read = 0, current_offset = read_data; | 1794 | for (total_read = 0, current_offset = read_data; |
1794 | read_size > total_read; | 1795 | read_size > total_read; |
@@ -1869,7 +1870,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1869 | open_file = (struct cifsFileInfo *)file->private_data; | 1870 | open_file = (struct cifsFileInfo *)file->private_data; |
1870 | 1871 | ||
1871 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) | 1872 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) |
1872 | cFYI(1, ("attempting read on write only file instance")); | 1873 | cFYI(1, "attempting read on write only file instance"); |
1873 | 1874 | ||
1874 | for (total_read = 0, current_offset = read_data; | 1875 | for (total_read = 0, current_offset = read_data; |
1875 | read_size > total_read; | 1876 | read_size > total_read; |
@@ -1920,7 +1921,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
1920 | xid = GetXid(); | 1921 | xid = GetXid(); |
1921 | rc = cifs_revalidate_file(file); | 1922 | rc = cifs_revalidate_file(file); |
1922 | if (rc) { | 1923 | if (rc) { |
1923 | cFYI(1, ("Validation prior to mmap failed, error=%d", rc)); | 1924 | cFYI(1, "Validation prior to mmap failed, error=%d", rc); |
1924 | FreeXid(xid); | 1925 | FreeXid(xid); |
1925 | return rc; | 1926 | return rc; |
1926 | } | 1927 | } |
@@ -1931,8 +1932,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
1931 | 1932 | ||
1932 | 1933 | ||
1933 | static void cifs_copy_cache_pages(struct address_space *mapping, | 1934 | static void cifs_copy_cache_pages(struct address_space *mapping, |
1934 | struct list_head *pages, int bytes_read, char *data, | 1935 | struct list_head *pages, int bytes_read, char *data) |
1935 | struct pagevec *plru_pvec) | ||
1936 | { | 1936 | { |
1937 | struct page *page; | 1937 | struct page *page; |
1938 | char *target; | 1938 | char *target; |
@@ -1944,10 +1944,10 @@ static void cifs_copy_cache_pages(struct address_space *mapping, | |||
1944 | page = list_entry(pages->prev, struct page, lru); | 1944 | page = list_entry(pages->prev, struct page, lru); |
1945 | list_del(&page->lru); | 1945 | list_del(&page->lru); |
1946 | 1946 | ||
1947 | if (add_to_page_cache(page, mapping, page->index, | 1947 | if (add_to_page_cache_lru(page, mapping, page->index, |
1948 | GFP_KERNEL)) { | 1948 | GFP_KERNEL)) { |
1949 | page_cache_release(page); | 1949 | page_cache_release(page); |
1950 | cFYI(1, ("Add page cache failed")); | 1950 | cFYI(1, "Add page cache failed"); |
1951 | data += PAGE_CACHE_SIZE; | 1951 | data += PAGE_CACHE_SIZE; |
1952 | bytes_read -= PAGE_CACHE_SIZE; | 1952 | bytes_read -= PAGE_CACHE_SIZE; |
1953 | continue; | 1953 | continue; |
@@ -1970,8 +1970,6 @@ static void cifs_copy_cache_pages(struct address_space *mapping, | |||
1970 | flush_dcache_page(page); | 1970 | flush_dcache_page(page); |
1971 | SetPageUptodate(page); | 1971 | SetPageUptodate(page); |
1972 | unlock_page(page); | 1972 | unlock_page(page); |
1973 | if (!pagevec_add(plru_pvec, page)) | ||
1974 | __pagevec_lru_add_file(plru_pvec); | ||
1975 | data += PAGE_CACHE_SIZE; | 1973 | data += PAGE_CACHE_SIZE; |
1976 | } | 1974 | } |
1977 | return; | 1975 | return; |
@@ -1990,7 +1988,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1990 | unsigned int read_size, i; | 1988 | unsigned int read_size, i; |
1991 | char *smb_read_data = NULL; | 1989 | char *smb_read_data = NULL; |
1992 | struct smb_com_read_rsp *pSMBr; | 1990 | struct smb_com_read_rsp *pSMBr; |
1993 | struct pagevec lru_pvec; | ||
1994 | struct cifsFileInfo *open_file; | 1991 | struct cifsFileInfo *open_file; |
1995 | int buf_type = CIFS_NO_BUFFER; | 1992 | int buf_type = CIFS_NO_BUFFER; |
1996 | 1993 | ||
@@ -2004,8 +2001,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2004 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 2001 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
2005 | pTcon = cifs_sb->tcon; | 2002 | pTcon = cifs_sb->tcon; |
2006 | 2003 | ||
2007 | pagevec_init(&lru_pvec, 0); | 2004 | cFYI(DBG2, "rpages: num pages %d", num_pages); |
2008 | cFYI(DBG2, ("rpages: num pages %d", num_pages)); | ||
2009 | for (i = 0; i < num_pages; ) { | 2005 | for (i = 0; i < num_pages; ) { |
2010 | unsigned contig_pages; | 2006 | unsigned contig_pages; |
2011 | struct page *tmp_page; | 2007 | struct page *tmp_page; |
@@ -2038,8 +2034,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2038 | /* Read size needs to be in multiples of one page */ | 2034 | /* Read size needs to be in multiples of one page */ |
2039 | read_size = min_t(const unsigned int, read_size, | 2035 | read_size = min_t(const unsigned int, read_size, |
2040 | cifs_sb->rsize & PAGE_CACHE_MASK); | 2036 | cifs_sb->rsize & PAGE_CACHE_MASK); |
2041 | cFYI(DBG2, ("rpages: read size 0x%x contiguous pages %d", | 2037 | cFYI(DBG2, "rpages: read size 0x%x contiguous pages %d", |
2042 | read_size, contig_pages)); | 2038 | read_size, contig_pages); |
2043 | rc = -EAGAIN; | 2039 | rc = -EAGAIN; |
2044 | while (rc == -EAGAIN) { | 2040 | while (rc == -EAGAIN) { |
2045 | if ((open_file->invalidHandle) && | 2041 | if ((open_file->invalidHandle) && |
@@ -2066,14 +2062,14 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2066 | } | 2062 | } |
2067 | } | 2063 | } |
2068 | if ((rc < 0) || (smb_read_data == NULL)) { | 2064 | if ((rc < 0) || (smb_read_data == NULL)) { |
2069 | cFYI(1, ("Read error in readpages: %d", rc)); | 2065 | cFYI(1, "Read error in readpages: %d", rc); |
2070 | break; | 2066 | break; |
2071 | } else if (bytes_read > 0) { | 2067 | } else if (bytes_read > 0) { |
2072 | task_io_account_read(bytes_read); | 2068 | task_io_account_read(bytes_read); |
2073 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; | 2069 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; |
2074 | cifs_copy_cache_pages(mapping, page_list, bytes_read, | 2070 | cifs_copy_cache_pages(mapping, page_list, bytes_read, |
2075 | smb_read_data + 4 /* RFC1001 hdr */ + | 2071 | smb_read_data + 4 /* RFC1001 hdr */ + |
2076 | le16_to_cpu(pSMBr->DataOffset), &lru_pvec); | 2072 | le16_to_cpu(pSMBr->DataOffset)); |
2077 | 2073 | ||
2078 | i += bytes_read >> PAGE_CACHE_SHIFT; | 2074 | i += bytes_read >> PAGE_CACHE_SHIFT; |
2079 | cifs_stats_bytes_read(pTcon, bytes_read); | 2075 | cifs_stats_bytes_read(pTcon, bytes_read); |
@@ -2089,9 +2085,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2089 | /* break; */ | 2085 | /* break; */ |
2090 | } | 2086 | } |
2091 | } else { | 2087 | } else { |
2092 | cFYI(1, ("No bytes read (%d) at offset %lld . " | 2088 | cFYI(1, "No bytes read (%d) at offset %lld . " |
2093 | "Cleaning remaining pages from readahead list", | 2089 | "Cleaning remaining pages from readahead list", |
2094 | bytes_read, offset)); | 2090 | bytes_read, offset); |
2095 | /* BB turn off caching and do new lookup on | 2091 | /* BB turn off caching and do new lookup on |
2096 | file size at server? */ | 2092 | file size at server? */ |
2097 | break; | 2093 | break; |
@@ -2106,8 +2102,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2106 | bytes_read = 0; | 2102 | bytes_read = 0; |
2107 | } | 2103 | } |
2108 | 2104 | ||
2109 | pagevec_lru_add_file(&lru_pvec); | ||
2110 | |||
2111 | /* need to free smb_read_data buf before exit */ | 2105 | /* need to free smb_read_data buf before exit */ |
2112 | if (smb_read_data) { | 2106 | if (smb_read_data) { |
2113 | if (buf_type == CIFS_SMALL_BUFFER) | 2107 | if (buf_type == CIFS_SMALL_BUFFER) |
@@ -2136,7 +2130,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page, | |||
2136 | if (rc < 0) | 2130 | if (rc < 0) |
2137 | goto io_error; | 2131 | goto io_error; |
2138 | else | 2132 | else |
2139 | cFYI(1, ("Bytes read %d", rc)); | 2133 | cFYI(1, "Bytes read %d", rc); |
2140 | 2134 | ||
2141 | file->f_path.dentry->d_inode->i_atime = | 2135 | file->f_path.dentry->d_inode->i_atime = |
2142 | current_fs_time(file->f_path.dentry->d_inode->i_sb); | 2136 | current_fs_time(file->f_path.dentry->d_inode->i_sb); |
@@ -2168,8 +2162,8 @@ static int cifs_readpage(struct file *file, struct page *page) | |||
2168 | return rc; | 2162 | return rc; |
2169 | } | 2163 | } |
2170 | 2164 | ||
2171 | cFYI(1, ("readpage %p at offset %d 0x%x\n", | 2165 | cFYI(1, "readpage %p at offset %d 0x%x\n", |
2172 | page, (int)offset, (int)offset)); | 2166 | page, (int)offset, (int)offset); |
2173 | 2167 | ||
2174 | rc = cifs_readpage_worker(file, page, &offset); | 2168 | rc = cifs_readpage_worker(file, page, &offset); |
2175 | 2169 | ||
@@ -2239,7 +2233,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping, | |||
2239 | struct page *page; | 2233 | struct page *page; |
2240 | int rc = 0; | 2234 | int rc = 0; |
2241 | 2235 | ||
2242 | cFYI(1, ("write_begin from %lld len %d", (long long)pos, len)); | 2236 | cFYI(1, "write_begin from %lld len %d", (long long)pos, len); |
2243 | 2237 | ||
2244 | page = grab_cache_page_write_begin(mapping, index, flags); | 2238 | page = grab_cache_page_write_begin(mapping, index, flags); |
2245 | if (!page) { | 2239 | if (!page) { |
@@ -2311,12 +2305,10 @@ cifs_oplock_break(struct slow_work *work) | |||
2311 | int rc, waitrc = 0; | 2305 | int rc, waitrc = 0; |
2312 | 2306 | ||
2313 | if (inode && S_ISREG(inode->i_mode)) { | 2307 | if (inode && S_ISREG(inode->i_mode)) { |
2314 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 2308 | if (cinode->clientCanCacheRead) |
2315 | if (cinode->clientCanCacheAll == 0) | ||
2316 | break_lease(inode, O_RDONLY); | 2309 | break_lease(inode, O_RDONLY); |
2317 | else if (cinode->clientCanCacheRead == 0) | 2310 | else |
2318 | break_lease(inode, O_WRONLY); | 2311 | break_lease(inode, O_WRONLY); |
2319 | #endif | ||
2320 | rc = filemap_fdatawrite(inode->i_mapping); | 2312 | rc = filemap_fdatawrite(inode->i_mapping); |
2321 | if (cinode->clientCanCacheRead == 0) { | 2313 | if (cinode->clientCanCacheRead == 0) { |
2322 | waitrc = filemap_fdatawait(inode->i_mapping); | 2314 | waitrc = filemap_fdatawait(inode->i_mapping); |
@@ -2326,7 +2318,7 @@ cifs_oplock_break(struct slow_work *work) | |||
2326 | rc = waitrc; | 2318 | rc = waitrc; |
2327 | if (rc) | 2319 | if (rc) |
2328 | cinode->write_behind_rc = rc; | 2320 | cinode->write_behind_rc = rc; |
2329 | cFYI(1, ("Oplock flush inode %p rc %d", inode, rc)); | 2321 | cFYI(1, "Oplock flush inode %p rc %d", inode, rc); |
2330 | } | 2322 | } |
2331 | 2323 | ||
2332 | /* | 2324 | /* |
@@ -2338,7 +2330,7 @@ cifs_oplock_break(struct slow_work *work) | |||
2338 | if (!cfile->closePend && !cfile->oplock_break_cancelled) { | 2330 | if (!cfile->closePend && !cfile->oplock_break_cancelled) { |
2339 | rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0, | 2331 | rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0, |
2340 | LOCKING_ANDX_OPLOCK_RELEASE, false); | 2332 | LOCKING_ANDX_OPLOCK_RELEASE, false); |
2341 | cFYI(1, ("Oplock release rc = %d", rc)); | 2333 | cFYI(1, "Oplock release rc = %d", rc); |
2342 | } | 2334 | } |
2343 | } | 2335 | } |
2344 | 2336 | ||