cifs: obtain file access during backup intent lookup (resend)
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / cifs / smb1ops.c
index 8727ef712a3cff087ec618273e4cbe7cfc57f5bd..56cc4be87807ae2c734b647c5c78d5480d234e7b 100644 (file)
@@ -483,9 +483,6 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
        if (!(server->capabilities & CAP_LARGE_READ_X))
                rsize = min_t(unsigned int, CIFSMaxBufSize, rsize);
 
-       /* limit to the amount that we can kmap at once */
-       rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT);
-
        /* hard limit of CIFS_MAX_RSIZE */
        rsize = min_t(unsigned int, rsize, CIFS_MAX_RSIZE);
 
@@ -723,11 +720,11 @@ cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
        cinode->can_cache_brlcks = cinode->clientCanCacheAll;
 }
 
-static int
+static void
 cifs_close_file(const unsigned int xid, struct cifs_tcon *tcon,
                struct cifs_fid *fid)
 {
-       return CIFSSMBClose(xid, tcon, fid->netfid);
+       CIFSSMBClose(xid, tcon, fid->netfid);
 }
 
 static int
@@ -840,10 +837,8 @@ cifs_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
                     struct cifs_fid *fid, __u16 search_flags,
                     struct cifs_search_info *srch_inf)
 {
-       return CIFSFindFirst(xid, tcon, path, cifs_sb->local_nls,
-                            &fid->netfid, search_flags, srch_inf,
-                            cifs_sb->mnt_cifs_flags &
-                            CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb));
+       return CIFSFindFirst(xid, tcon, path, cifs_sb,
+                            &fid->netfid, search_flags, srch_inf, true);
 }
 
 static int
@@ -902,6 +897,15 @@ cifs_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
        return rc;
 }
 
+static int
+cifs_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset,
+              __u64 length, __u32 type, int lock, int unlock, bool wait)
+{
+       return CIFSSMBLock(xid, tlink_tcon(cfile->tlink), cfile->fid.netfid,
+                          current->tgid, length, offset, unlock, lock,
+                          (__u8)type, wait, 0);
+}
+
 struct smb_version_operations smb1_operations = {
        .send_cancel = send_nt_cancel,
        .compare_fids = cifs_compare_fids,
@@ -963,6 +967,9 @@ struct smb_version_operations smb1_operations = {
        .calc_smb_size = smbCalcSize,
        .oplock_response = cifs_oplock_response,
        .queryfs = cifs_queryfs,
+       .mand_lock = cifs_mand_lock,
+       .mand_unlock_range = cifs_unlock_range,
+       .push_mand_locks = cifs_push_mandatory_locks,
 };
 
 struct smb_version_values smb1_values = {