Skip to content

Commit 03bdeda

Browse files
committed
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "A few small cifs fixes including two for stable, and fixing a regression introduced by the VFS change to file create" * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: cifs: set FILE_CREATED cifs: We do not drop reference to tlink in CIFSCheckMFSymlink() Add missing end of line termination to some cifs messages
2 parents 71ce176 + f1e3268 commit 03bdeda

5 files changed

Lines changed: 28 additions & 28 deletions

File tree

‎fs/cifs/cifsproto.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
477477
const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
478478
extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
479479
extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);
480-
extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr,
481-
const unsigned char *path,
482-
struct cifs_sb_info *cifs_sb, unsigned int xid);
480+
extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
481+
struct cifs_sb_info *cifs_sb,
482+
struct cifs_fattr *fattr,
483+
const unsigned char *path);
483484
extern int mdfour(unsigned char *, unsigned char *, int);
484485
extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
485486
const struct nls_table *codepage);

‎fs/cifs/cifssmb.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4010,7 +4010,7 @@ CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
40104010
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
40114011
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
40124012
if (rc) {
4013-
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4013+
cifs_dbg(FYI, "Send error in QFileInfo = %d", rc);
40144014
} else { /* decode response */
40154015
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
40164016

@@ -4179,7 +4179,7 @@ CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
41794179
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
41804180
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
41814181
if (rc) {
4182-
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4182+
cifs_dbg(FYI, "Send error in UnixQFileInfo = %d", rc);
41834183
} else { /* decode response */
41844184
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
41854185

@@ -4263,7 +4263,7 @@ CIFSSMBUnixQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
42634263
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
42644264
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
42654265
if (rc) {
4266-
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4266+
cifs_dbg(FYI, "Send error in UnixQPathInfo = %d", rc);
42674267
} else { /* decode response */
42684268
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
42694269

‎fs/cifs/dir.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ check_name(struct dentry *direntry)
193193
static int
194194
cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
195195
struct tcon_link *tlink, unsigned oflags, umode_t mode,
196-
__u32 *oplock, struct cifs_fid *fid, int *created)
196+
__u32 *oplock, struct cifs_fid *fid)
197197
{
198198
int rc = -ENOENT;
199199
int create_options = CREATE_NOT_DIR;
@@ -349,7 +349,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
349349
.device = 0,
350350
};
351351

352-
*created |= FILE_CREATED;
353352
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
354353
args.uid = current_fsuid();
355354
if (inode->i_mode & S_ISGID)
@@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
480479
cifs_add_pending_open(&fid, tlink, &open);
481480

482481
rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
483-
&oplock, &fid, opened);
482+
&oplock, &fid);
484483

485484
if (rc) {
486485
cifs_del_pending_open(&open);
487486
goto out;
488487
}
489488

489+
if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
490+
*opened |= FILE_CREATED;
491+
490492
rc = finish_open(file, direntry, generic_file_open, opened);
491493
if (rc) {
492494
if (server->ops->close)
@@ -529,7 +531,6 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
529531
struct TCP_Server_Info *server;
530532
struct cifs_fid fid;
531533
__u32 oplock;
532-
int created = FILE_CREATED;
533534

534535
cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",
535536
inode, direntry->d_name.name, direntry);
@@ -546,7 +547,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
546547
server->ops->new_lease_key(&fid);
547548

548549
rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
549-
&oplock, &fid, &created);
550+
&oplock, &fid);
550551
if (!rc && server->ops->close)
551552
server->ops->close(xid, tcon, &fid);
552553

‎fs/cifs/inode.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
383383

384384
/* check for Minshall+French symlinks */
385385
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
386-
int tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
386+
int tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
387+
full_path);
387388
if (tmprc)
388389
cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
389390
}
@@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
799800

800801
/* check for Minshall+French symlinks */
801802
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
802-
tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
803+
tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
804+
full_path);
803805
if (tmprc)
804806
cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
805807
}

‎fs/cifs/link.c‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
354354

355355

356356
int
357-
CIFSCheckMFSymlink(struct cifs_fattr *fattr,
358-
const unsigned char *path,
359-
struct cifs_sb_info *cifs_sb, unsigned int xid)
357+
CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
358+
struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
359+
const unsigned char *path)
360360
{
361-
int rc = 0;
361+
int rc;
362362
u8 *buf = NULL;
363363
unsigned int link_len = 0;
364364
unsigned int bytes_read = 0;
365-
struct cifs_tcon *ptcon;
366365

367366
if (!CIFSCouldBeMFSymlink(fattr))
368367
/* it's not a symlink */
369368
return 0;
370369

371370
buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
372-
if (!buf) {
373-
rc = -ENOMEM;
374-
goto out;
375-
}
371+
if (!buf)
372+
return -ENOMEM;
376373

377-
ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb));
378-
if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink))
379-
rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,
380-
&bytes_read, cifs_sb, xid);
374+
if (tcon->ses->server->ops->query_mf_symlink)
375+
rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
376+
&bytes_read, cifs_sb, xid);
381377
else
382-
goto out;
378+
rc = -ENOSYS;
383379

384-
if (rc != 0)
380+
if (rc)
385381
goto out;
386382

387383
if (bytes_read == 0) /* not a symlink */

0 commit comments

Comments
 (0)