diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsglob.h | 5 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 7 | ||||
-rw-r--r-- | fs/cifs/link.c | 37 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 2 |
4 files changed, 20 insertions, 31 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f918a998a087..fba4d1341f88 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -370,8 +370,9 @@ struct smb_version_operations { | |||
370 | void (*new_lease_key)(struct cifs_fid *); | 370 | void (*new_lease_key)(struct cifs_fid *); |
371 | int (*generate_signingkey)(struct cifs_ses *); | 371 | int (*generate_signingkey)(struct cifs_ses *); |
372 | int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *); | 372 | int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *); |
373 | int (*query_mf_symlink)(const unsigned char *, char *, unsigned int *, | 373 | int (*query_mf_symlink)(unsigned int, struct cifs_tcon *, |
374 | struct cifs_sb_info *, unsigned int); | 374 | struct cifs_sb_info *, const unsigned char *, |
375 | char *, unsigned int *); | ||
375 | /* if we can do cache read operations */ | 376 | /* if we can do cache read operations */ |
376 | bool (*is_read_op)(__u32); | 377 | bool (*is_read_op)(__u32); |
377 | /* set oplock level for the inode */ | 378 | /* set oplock level for the inode */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 2c29db6a247e..10b9ab1d1ae9 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -496,7 +496,8 @@ void cifs_writev_complete(struct work_struct *work); | |||
496 | struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, | 496 | struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, |
497 | work_func_t complete); | 497 | work_func_t complete); |
498 | void cifs_writedata_release(struct kref *refcount); | 498 | void cifs_writedata_release(struct kref *refcount); |
499 | int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, | 499 | int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, |
500 | unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, | 500 | struct cifs_sb_info *cifs_sb, |
501 | unsigned int xid); | 501 | const unsigned char *path, char *pbuf, |
502 | unsigned int *pbytes_read); | ||
502 | #endif /* _CIFSPROTO_H */ | 503 | #endif /* _CIFSPROTO_H */ |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 28bc8ee97056..c8e29682ccdb 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -305,54 +305,41 @@ CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr) | |||
305 | } | 305 | } |
306 | 306 | ||
307 | int | 307 | int |
308 | open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, | 308 | cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, |
309 | unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, | 309 | struct cifs_sb_info *cifs_sb, const unsigned char *path, |
310 | unsigned int xid) | 310 | char *pbuf, unsigned int *pbytes_read) |
311 | { | 311 | { |
312 | int rc; | 312 | int rc; |
313 | int oplock = 0; | 313 | int oplock = 0; |
314 | __u16 netfid = 0; | 314 | __u16 netfid = 0; |
315 | struct tcon_link *tlink; | ||
316 | struct cifs_tcon *ptcon; | ||
317 | struct cifs_io_parms io_parms; | 315 | struct cifs_io_parms io_parms; |
318 | int buf_type = CIFS_NO_BUFFER; | 316 | int buf_type = CIFS_NO_BUFFER; |
319 | FILE_ALL_INFO file_info; | 317 | FILE_ALL_INFO file_info; |
320 | 318 | ||
321 | tlink = cifs_sb_tlink(cifs_sb); | 319 | rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, GENERIC_READ, |
322 | if (IS_ERR(tlink)) | ||
323 | return PTR_ERR(tlink); | ||
324 | ptcon = tlink_tcon(tlink); | ||
325 | |||
326 | rc = CIFSSMBOpen(xid, ptcon, path, FILE_OPEN, GENERIC_READ, | ||
327 | CREATE_NOT_DIR, &netfid, &oplock, &file_info, | 320 | CREATE_NOT_DIR, &netfid, &oplock, &file_info, |
328 | cifs_sb->local_nls, | 321 | cifs_sb->local_nls, |
329 | cifs_sb->mnt_cifs_flags & | 322 | cifs_sb->mnt_cifs_flags & |
330 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 323 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
331 | if (rc != 0) { | 324 | if (rc) |
332 | cifs_put_tlink(tlink); | ||
333 | return rc; | 325 | return rc; |
334 | } | ||
335 | 326 | ||
336 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { | 327 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) |
337 | CIFSSMBClose(xid, ptcon, netfid); | ||
338 | cifs_put_tlink(tlink); | ||
339 | /* it's not a symlink */ | 328 | /* it's not a symlink */ |
340 | return rc; | 329 | goto out; |
341 | } | ||
342 | 330 | ||
343 | io_parms.netfid = netfid; | 331 | io_parms.netfid = netfid; |
344 | io_parms.pid = current->tgid; | 332 | io_parms.pid = current->tgid; |
345 | io_parms.tcon = ptcon; | 333 | io_parms.tcon = tcon; |
346 | io_parms.offset = 0; | 334 | io_parms.offset = 0; |
347 | io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; | 335 | io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; |
348 | 336 | ||
349 | rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type); | 337 | rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type); |
350 | CIFSSMBClose(xid, ptcon, netfid); | 338 | out: |
351 | cifs_put_tlink(tlink); | 339 | CIFSSMBClose(xid, tcon, netfid); |
352 | return rc; | 340 | return rc; |
353 | } | 341 | } |
354 | 342 | ||
355 | |||
356 | int | 343 | int |
357 | CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, | 344 | CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, |
358 | struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, | 345 | struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, |
@@ -372,8 +359,8 @@ CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon, | |||
372 | return -ENOMEM; | 359 | return -ENOMEM; |
373 | 360 | ||
374 | if (tcon->ses->server->ops->query_mf_symlink) | 361 | if (tcon->ses->server->ops->query_mf_symlink) |
375 | rc = tcon->ses->server->ops->query_mf_symlink(path, buf, | 362 | rc = tcon->ses->server->ops->query_mf_symlink(xid, tcon, |
376 | &bytes_read, cifs_sb, xid); | 363 | cifs_sb, path, buf, &bytes_read); |
377 | else | 364 | else |
378 | rc = -ENOSYS; | 365 | rc = -ENOSYS; |
379 | 366 | ||
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 5f5ba0dc2ee1..099c27602257 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -1009,7 +1009,7 @@ struct smb_version_operations smb1_operations = { | |||
1009 | .mand_lock = cifs_mand_lock, | 1009 | .mand_lock = cifs_mand_lock, |
1010 | .mand_unlock_range = cifs_unlock_range, | 1010 | .mand_unlock_range = cifs_unlock_range, |
1011 | .push_mand_locks = cifs_push_mandatory_locks, | 1011 | .push_mand_locks = cifs_push_mandatory_locks, |
1012 | .query_mf_symlink = open_query_close_cifs_symlink, | 1012 | .query_mf_symlink = cifs_query_mf_symlink, |
1013 | .is_read_op = cifs_is_read_op, | 1013 | .is_read_op = cifs_is_read_op, |
1014 | }; | 1014 | }; |
1015 | 1015 | ||