Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: (23 commits)
  cifs: fix noserverino handling when unix extensions are enabled
  cifs: don't update uniqueid in cifs_fattr_to_inode
  cifs: always revalidate hardlinked inodes when using noserverino
  [CIFS] drop quota operation stubs
  cifs: propagate cifs_new_fileinfo() error back to the caller
  cifs: add comments explaining cifs_new_fileinfo behavior
  cifs: remove unused parameter from cifs_posix_open_inode_helper()
  [CIFS] Remove unused cifs_oplock_cachep
  cifs: have decode_negTokenInit set flags in server struct
  cifs: break negotiate protocol calls out of cifs_setup_session
  cifs: eliminate "first_time" parm to CIFS_SessSetup
  [CIFS] Fix lease break for writes
  cifs: save the dialect chosen by server
  cifs: change && to ||
  cifs: rename "extended_security" to "global_secflags"
  cifs: move tcon find/create into separate function
  cifs: move SMB session creation code into separate function
  cifs: track local_nls in volume info
  [CIFS] Allow null nd (as nfs server uses) on create
  [CIFS] Fix losing locks during fork()
  ...
This commit is contained in:
Linus Torvalds 2010-05-18 07:18:38 -07:00
commit fd25a1f556
27 changed files with 1234 additions and 1251 deletions

View file

@ -492,17 +492,13 @@ compare_oid(unsigned long *oid1, unsigned int oid1len,
int int
decode_negTokenInit(unsigned char *security_blob, int length, decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType) struct TCP_Server_Info *server)
{ {
struct asn1_ctx ctx; struct asn1_ctx ctx;
unsigned char *end; unsigned char *end;
unsigned char *sequence_end; unsigned char *sequence_end;
unsigned long *oid = NULL; unsigned long *oid = NULL;
unsigned int cls, con, tag, oidlen, rc; unsigned int cls, con, tag, oidlen, rc;
bool use_ntlmssp = false;
bool use_kerberos = false;
bool use_kerberosu2u = false;
bool use_mskerberos = false;
/* cifs_dump_mem(" Received SecBlob ", security_blob, length); */ /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
@ -510,11 +506,11 @@ decode_negTokenInit(unsigned char *security_blob, int length,
/* GSSAPI header */ /* GSSAPI header */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding negTokenInit header")); cFYI(1, "Error decoding negTokenInit header");
return 0; return 0;
} else if ((cls != ASN1_APL) || (con != ASN1_CON) } else if ((cls != ASN1_APL) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) { || (tag != ASN1_EOC)) {
cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag)); cFYI(1, "cls = %d con = %d tag = %d", cls, con, tag);
return 0; return 0;
} }
@ -535,56 +531,52 @@ decode_negTokenInit(unsigned char *security_blob, int length,
/* SPNEGO OID not present or garbled -- bail out */ /* SPNEGO OID not present or garbled -- bail out */
if (!rc) { if (!rc) {
cFYI(1, ("Error decoding negTokenInit header")); cFYI(1, "Error decoding negTokenInit header");
return 0; return 0;
} }
/* SPNEGO */ /* SPNEGO */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding negTokenInit")); cFYI(1, "Error decoding negTokenInit");
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON) } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) { || (tag != ASN1_EOC)) {
cFYI(1, cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
("cls = %d con = %d tag = %d end = %p (%d) exit 0", cls, con, tag, end, *end);
cls, con, tag, end, *end));
return 0; return 0;
} }
/* negTokenInit */ /* negTokenInit */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding negTokenInit")); cFYI(1, "Error decoding negTokenInit");
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
cFYI(1, cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
("cls = %d con = %d tag = %d end = %p (%d) exit 1", cls, con, tag, end, *end);
cls, con, tag, end, *end));
return 0; return 0;
} }
/* sequence */ /* sequence */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding 2nd part of negTokenInit")); cFYI(1, "Error decoding 2nd part of negTokenInit");
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON) } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) { || (tag != ASN1_EOC)) {
cFYI(1, cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
("cls = %d con = %d tag = %d end = %p (%d) exit 0", cls, con, tag, end, *end);
cls, con, tag, end, *end));
return 0; return 0;
} }
/* sequence of */ /* sequence of */
if (asn1_header_decode if (asn1_header_decode
(&ctx, &sequence_end, &cls, &con, &tag) == 0) { (&ctx, &sequence_end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding 2nd part of negTokenInit")); cFYI(1, "Error decoding 2nd part of negTokenInit");
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
cFYI(1, cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
("cls = %d con = %d tag = %d end = %p (%d) exit 1", cls, con, tag, end, *end);
cls, con, tag, end, *end));
return 0; return 0;
} }
@ -592,37 +584,33 @@ decode_negTokenInit(unsigned char *security_blob, int length,
while (!asn1_eoc_decode(&ctx, sequence_end)) { while (!asn1_eoc_decode(&ctx, sequence_end)) {
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
if (!rc) { if (!rc) {
cFYI(1, cFYI(1, "Error decoding negTokenInit hdr exit2");
("Error decoding negTokenInit hdr exit2"));
return 0; return 0;
} }
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) { if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) {
cFYI(1, ("OID len = %d oid = 0x%lx 0x%lx " cFYI(1, "OID len = %d oid = 0x%lx 0x%lx "
"0x%lx 0x%lx", oidlen, *oid, "0x%lx 0x%lx", oidlen, *oid,
*(oid + 1), *(oid + 2), *(oid + 3))); *(oid + 1), *(oid + 2), *(oid + 3));
if (compare_oid(oid, oidlen, MSKRB5_OID, if (compare_oid(oid, oidlen, MSKRB5_OID,
MSKRB5_OID_LEN) && MSKRB5_OID_LEN))
!use_mskerberos) server->sec_mskerberos = true;
use_mskerberos = true;
else if (compare_oid(oid, oidlen, KRB5U2U_OID, else if (compare_oid(oid, oidlen, KRB5U2U_OID,
KRB5U2U_OID_LEN) && KRB5U2U_OID_LEN))
!use_kerberosu2u) server->sec_kerberosu2u = true;
use_kerberosu2u = true;
else if (compare_oid(oid, oidlen, KRB5_OID, else if (compare_oid(oid, oidlen, KRB5_OID,
KRB5_OID_LEN) && KRB5_OID_LEN))
!use_kerberos) server->sec_kerberos = true;
use_kerberos = true;
else if (compare_oid(oid, oidlen, NTLMSSP_OID, else if (compare_oid(oid, oidlen, NTLMSSP_OID,
NTLMSSP_OID_LEN)) NTLMSSP_OID_LEN))
use_ntlmssp = true; server->sec_ntlmssp = true;
kfree(oid); kfree(oid);
} }
} else { } else {
cFYI(1, ("Should be an oid what is going on?")); cFYI(1, "Should be an oid what is going on?");
} }
} }
@ -632,54 +620,47 @@ decode_negTokenInit(unsigned char *security_blob, int length,
no mechListMic (e.g. NTLMSSP instead of KRB5) */ no mechListMic (e.g. NTLMSSP instead of KRB5) */
if (ctx.error == ASN1_ERR_DEC_EMPTY) if (ctx.error == ASN1_ERR_DEC_EMPTY)
goto decode_negtoken_exit; goto decode_negtoken_exit;
cFYI(1, ("Error decoding last part negTokenInit exit3")); cFYI(1, "Error decoding last part negTokenInit exit3");
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
/* tag = 3 indicating mechListMIC */ /* tag = 3 indicating mechListMIC */
cFYI(1, ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end);
return 0; return 0;
} }
/* sequence */ /* sequence */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding last part negTokenInit exit5")); cFYI(1, "Error decoding last part negTokenInit exit5");
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)", cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end);
} }
/* sequence of */ /* sequence of */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding last part negTokenInit exit 7")); cFYI(1, "Error decoding last part negTokenInit exit 7");
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
cFYI(1, ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)", cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end);
return 0; return 0;
} }
/* general string */ /* general string */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding last part negTokenInit exit9")); cFYI(1, "Error decoding last part negTokenInit exit9");
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI) } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|| (tag != ASN1_GENSTR)) { || (tag != ASN1_GENSTR)) {
cFYI(1, ("Exit10 cls = %d con = %d tag = %d end = %p (%d)", cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end);
return 0; return 0;
} }
cFYI(1, ("Need to call asn1_octets_decode() function for %s", cFYI(1, "Need to call asn1_octets_decode() function for %s",
ctx.pointer)); /* is this UTF-8 or ASCII? */ ctx.pointer); /* is this UTF-8 or ASCII? */
decode_negtoken_exit: decode_negtoken_exit:
if (use_kerberos)
*secType = Kerberos;
else if (use_mskerberos)
*secType = MSKerberos;
else if (use_ntlmssp)
*secType = RawNTLMSSP;
return 1; return 1;
} }

View file

@ -60,10 +60,10 @@ cifs_dump_mem(char *label, void *data, int length)
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
void cifs_dump_detail(struct smb_hdr *smb) void cifs_dump_detail(struct smb_hdr *smb)
{ {
cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d", cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
smb->Command, smb->Status.CifsError, smb->Command, smb->Status.CifsError,
smb->Flags, smb->Flags2, smb->Mid, smb->Pid)); smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
cERROR(1, ("smb buf %p len %d", smb, smbCalcSize_LE(smb))); cERROR(1, "smb buf %p len %d", smb, smbCalcSize_LE(smb));
} }
@ -75,25 +75,25 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
if (server == NULL) if (server == NULL)
return; return;
cERROR(1, ("Dump pending requests:")); cERROR(1, "Dump pending requests:");
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
list_for_each(tmp, &server->pending_mid_q) { list_for_each(tmp, &server->pending_mid_q) {
mid_entry = list_entry(tmp, struct mid_q_entry, qhead); mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
cERROR(1, ("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d", cERROR(1, "State: %d Cmd: %d Pid: %d Tsk: %p Mid %d",
mid_entry->midState, mid_entry->midState,
(int)mid_entry->command, (int)mid_entry->command,
mid_entry->pid, mid_entry->pid,
mid_entry->tsk, mid_entry->tsk,
mid_entry->mid)); mid_entry->mid);
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
cERROR(1, ("IsLarge: %d buf: %p time rcv: %ld now: %ld", cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
mid_entry->largeBuf, mid_entry->largeBuf,
mid_entry->resp_buf, mid_entry->resp_buf,
mid_entry->when_received, mid_entry->when_received,
jiffies)); jiffies);
#endif /* STATS2 */ #endif /* STATS2 */
cERROR(1, ("IsMult: %d IsEnd: %d", mid_entry->multiRsp, cERROR(1, "IsMult: %d IsEnd: %d", mid_entry->multiRsp,
mid_entry->multiEnd)); mid_entry->multiEnd);
if (mid_entry->resp_buf) { if (mid_entry->resp_buf) {
cifs_dump_detail(mid_entry->resp_buf); cifs_dump_detail(mid_entry->resp_buf);
cifs_dump_mem("existing buf: ", cifs_dump_mem("existing buf: ",
@ -716,7 +716,7 @@ static const struct file_operations cifs_multiuser_mount_proc_fops = {
static int cifs_security_flags_proc_show(struct seq_file *m, void *v) static int cifs_security_flags_proc_show(struct seq_file *m, void *v)
{ {
seq_printf(m, "0x%x\n", extended_security); seq_printf(m, "0x%x\n", global_secflags);
return 0; return 0;
} }
@ -744,13 +744,13 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
/* single char or single char followed by null */ /* single char or single char followed by null */
c = flags_string[0]; c = flags_string[0];
if (c == '0' || c == 'n' || c == 'N') { if (c == '0' || c == 'n' || c == 'N') {
extended_security = CIFSSEC_DEF; /* default */ global_secflags = CIFSSEC_DEF; /* default */
return count; return count;
} else if (c == '1' || c == 'y' || c == 'Y') { } else if (c == '1' || c == 'y' || c == 'Y') {
extended_security = CIFSSEC_MAX; global_secflags = CIFSSEC_MAX;
return count; return count;
} else if (!isdigit(c)) { } else if (!isdigit(c)) {
cERROR(1, ("invalid flag %c", c)); cERROR(1, "invalid flag %c", c);
return -EINVAL; return -EINVAL;
} }
} }
@ -758,26 +758,26 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
flags = simple_strtoul(flags_string, NULL, 0); flags = simple_strtoul(flags_string, NULL, 0);
cFYI(1, ("sec flags 0x%x", flags)); cFYI(1, "sec flags 0x%x", flags);
if (flags <= 0) { if (flags <= 0) {
cERROR(1, ("invalid security flags %s", flags_string)); cERROR(1, "invalid security flags %s", flags_string);
return -EINVAL; return -EINVAL;
} }
if (flags & ~CIFSSEC_MASK) { if (flags & ~CIFSSEC_MASK) {
cERROR(1, ("attempt to set unsupported security flags 0x%x", cERROR(1, "attempt to set unsupported security flags 0x%x",
flags & ~CIFSSEC_MASK)); flags & ~CIFSSEC_MASK);
return -EINVAL; return -EINVAL;
} }
/* flags look ok - update the global security flags for cifs module */ /* flags look ok - update the global security flags for cifs module */
extended_security = flags; global_secflags = flags;
if (extended_security & CIFSSEC_MUST_SIGN) { if (global_secflags & CIFSSEC_MUST_SIGN) {
/* requiring signing implies signing is allowed */ /* requiring signing implies signing is allowed */
extended_security |= CIFSSEC_MAY_SIGN; global_secflags |= CIFSSEC_MAY_SIGN;
cFYI(1, ("packet signing now required")); cFYI(1, "packet signing now required");
} else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) { } else if ((global_secflags & CIFSSEC_MAY_SIGN) == 0) {
cFYI(1, ("packet signing disabled")); cFYI(1, "packet signing disabled");
} }
/* BB should we turn on MAY flags for other MUST options? */ /* BB should we turn on MAY flags for other MUST options? */
return count; return count;

View file

@ -43,34 +43,54 @@ void dump_smb(struct smb_hdr *, int);
*/ */
#ifdef CIFS_DEBUG #ifdef CIFS_DEBUG
/* information message: e.g., configuration, major event */ /* information message: e.g., configuration, major event */
extern int cifsFYI; extern int cifsFYI;
#define cifsfyi(format,arg...) if (cifsFYI & CIFS_INFO) printk(KERN_DEBUG " " __FILE__ ": " format "\n" "" , ## arg) #define cifsfyi(fmt, arg...) \
do { \
if (cifsFYI & CIFS_INFO) \
printk(KERN_DEBUG "%s: " fmt "\n", __FILE__, ##arg); \
} while (0)
#define cFYI(button,prspec) if (button) cifsfyi prspec #define cFYI(set, fmt, arg...) \
do { \
if (set) \
cifsfyi(fmt, ##arg); \
} while (0)
#define cifswarn(format, arg...) printk(KERN_WARNING ": " format "\n" , ## arg) #define cifswarn(fmt, arg...) \
printk(KERN_WARNING fmt "\n", ##arg)
/* debug event message: */ /* debug event message: */
extern int cifsERROR; extern int cifsERROR;
#define cEVENT(format,arg...) if (cifsERROR) printk(KERN_EVENT __FILE__ ": " format "\n" , ## arg) #define cEVENT(fmt, arg...) \
do { \
if (cifsERROR) \
printk(KERN_EVENT "%s: " fmt "\n", __FILE__, ##arg); \
} while (0)
/* error event message: e.g., i/o error */ /* error event message: e.g., i/o error */
#define cifserror(format,arg...) if (cifsERROR) printk(KERN_ERR " CIFS VFS: " format "\n" "" , ## arg) #define cifserror(fmt, arg...) \
do { \
if (cifsERROR) \
printk(KERN_ERR "CIFS VFS: " fmt "\n", ##arg); \
} while (0)
#define cERROR(button, prspec) if (button) cifserror prspec #define cERROR(set, fmt, arg...) \
do { \
if (set) \
cifserror(fmt, ##arg); \
} while (0)
/* /*
* debug OFF * debug OFF
* --------- * ---------
*/ */
#else /* _CIFS_DEBUG */ #else /* _CIFS_DEBUG */
#define cERROR(button, prspec) #define cERROR(set, fmt, arg...)
#define cEVENT(format, arg...) #define cEVENT(fmt, arg...)
#define cFYI(button, prspec) #define cFYI(set, fmt, arg...)
#define cifserror(format, arg...) #define cifserror(fmt, arg...)
#endif /* _CIFS_DEBUG */ #endif /* _CIFS_DEBUG */
#endif /* _H_CIFS_DEBUG */ #endif /* _H_CIFS_DEBUG */

View file

@ -85,8 +85,8 @@ static char *cifs_get_share_name(const char *node_name)
/* find server name end */ /* find server name end */
pSep = memchr(UNC+2, '\\', len-2); pSep = memchr(UNC+2, '\\', len-2);
if (!pSep) { if (!pSep) {
cERROR(1, ("%s: no server name end in node name: %s", cERROR(1, "%s: no server name end in node name: %s",
__func__, node_name)); __func__, node_name);
kfree(UNC); kfree(UNC);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
@ -142,8 +142,8 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
rc = dns_resolve_server_name_to_ip(*devname, &srvIP); rc = dns_resolve_server_name_to_ip(*devname, &srvIP);
if (rc != 0) { if (rc != 0) {
cERROR(1, ("%s: Failed to resolve server part of %s to IP: %d", cERROR(1, "%s: Failed to resolve server part of %s to IP: %d",
__func__, *devname, rc)); __func__, *devname, rc);
goto compose_mount_options_err; goto compose_mount_options_err;
} }
/* md_len = strlen(...) + 12 for 'sep+prefixpath=' /* md_len = strlen(...) + 12 for 'sep+prefixpath='
@ -217,8 +217,8 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
strcat(mountdata, fullpath + ref->path_consumed); strcat(mountdata, fullpath + ref->path_consumed);
} }
/*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/ /*cFYI(1, "%s: parent mountdata: %s", __func__,sb_mountdata);*/
/*cFYI(1, ("%s: submount mountdata: %s", __func__, mountdata ));*/ /*cFYI(1, "%s: submount mountdata: %s", __func__, mountdata );*/
compose_mount_options_out: compose_mount_options_out:
kfree(srvIP); kfree(srvIP);
@ -294,11 +294,11 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
static void dump_referral(const struct dfs_info3_param *ref) static void dump_referral(const struct dfs_info3_param *ref)
{ {
cFYI(1, ("DFS: ref path: %s", ref->path_name)); cFYI(1, "DFS: ref path: %s", ref->path_name);
cFYI(1, ("DFS: node path: %s", ref->node_name)); cFYI(1, "DFS: node path: %s", ref->node_name);
cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type)); cFYI(1, "DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type);
cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag, cFYI(1, "DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag,
ref->path_consumed)); ref->path_consumed);
} }
@ -314,7 +314,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
int rc = 0; int rc = 0;
struct vfsmount *mnt = ERR_PTR(-ENOENT); struct vfsmount *mnt = ERR_PTR(-ENOENT);
cFYI(1, ("in %s", __func__)); cFYI(1, "in %s", __func__);
BUG_ON(IS_ROOT(dentry)); BUG_ON(IS_ROOT(dentry));
xid = GetXid(); xid = GetXid();
@ -352,15 +352,15 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
/* connect to a node */ /* connect to a node */
len = strlen(referrals[i].node_name); len = strlen(referrals[i].node_name);
if (len < 2) { if (len < 2) {
cERROR(1, ("%s: Net Address path too short: %s", cERROR(1, "%s: Net Address path too short: %s",
__func__, referrals[i].node_name)); __func__, referrals[i].node_name);
rc = -EINVAL; rc = -EINVAL;
goto out_err; goto out_err;
} }
mnt = cifs_dfs_do_refmount(nd->path.mnt, mnt = cifs_dfs_do_refmount(nd->path.mnt,
nd->path.dentry, referrals + i); nd->path.dentry, referrals + i);
cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p", __func__, cFYI(1, "%s: cifs_dfs_do_refmount:%s , mnt:%p", __func__,
referrals[i].node_name, mnt)); referrals[i].node_name, mnt);
/* complete mount procedure if we accured submount */ /* complete mount procedure if we accured submount */
if (!IS_ERR(mnt)) if (!IS_ERR(mnt))
@ -378,7 +378,7 @@ out:
FreeXid(xid); FreeXid(xid);
free_dfs_info_array(referrals, num_referrals); free_dfs_info_array(referrals, num_referrals);
kfree(full_path); kfree(full_path);
cFYI(1, ("leaving %s" , __func__)); cFYI(1, "leaving %s" , __func__);
return ERR_PTR(rc); return ERR_PTR(rc);
out_err: out_err:
path_put(&nd->path); path_put(&nd->path);

View file

@ -133,9 +133,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
dp = description + strlen(description); dp = description + strlen(description);
/* for now, only sec=krb5 and sec=mskrb5 are valid */ /* for now, only sec=krb5 and sec=mskrb5 are valid */
if (server->secType == Kerberos) if (server->sec_kerberos)
sprintf(dp, ";sec=krb5"); sprintf(dp, ";sec=krb5");
else if (server->secType == MSKerberos) else if (server->sec_mskerberos)
sprintf(dp, ";sec=mskrb5"); sprintf(dp, ";sec=mskrb5");
else else
goto out; goto out;
@ -149,7 +149,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
dp = description + strlen(description); dp = description + strlen(description);
sprintf(dp, ";pid=0x%x", current->pid); sprintf(dp, ";pid=0x%x", current->pid);
cFYI(1, ("key description = %s", description)); cFYI(1, "key description = %s", description);
spnego_key = request_key(&cifs_spnego_key_type, description, ""); spnego_key = request_key(&cifs_spnego_key_type, description, "");
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2

View file

@ -200,9 +200,8 @@ cifs_strtoUCS(__le16 *to, const char *from, int len,
/* works for 2.4.0 kernel or later */ /* works for 2.4.0 kernel or later */
charlen = codepage->char2uni(from, len, &wchar_to[i]); charlen = codepage->char2uni(from, len, &wchar_to[i]);
if (charlen < 1) { if (charlen < 1) {
cERROR(1, cERROR(1, "strtoUCS: char2uni of %d returned %d",
("strtoUCS: char2uni of %d returned %d", (int)*from, charlen);
(int)*from, charlen));
/* A question mark */ /* A question mark */
to[i] = cpu_to_le16(0x003f); to[i] = cpu_to_le16(0x003f);
charlen = 1; charlen = 1;

View file

@ -87,11 +87,11 @@ int match_sid(struct cifs_sid *ctsid)
continue; /* all sub_auth values do not match */ continue; /* all sub_auth values do not match */
} }
cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname)); cFYI(1, "matching sid: %s\n", wksidarr[i].sidname);
return 0; /* sids compare/match */ return 0; /* sids compare/match */
} }
cFYI(1, ("No matching sid")); cFYI(1, "No matching sid");
return -1; return -1;
} }
@ -208,14 +208,14 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
*pbits_to_set &= ~S_IXUGO; *pbits_to_set &= ~S_IXUGO;
return; return;
} else if (type != ACCESS_ALLOWED) { } else if (type != ACCESS_ALLOWED) {
cERROR(1, ("unknown access control type %d", type)); cERROR(1, "unknown access control type %d", type);
return; return;
} }
/* else ACCESS_ALLOWED type */ /* else ACCESS_ALLOWED type */
if (flags & GENERIC_ALL) { if (flags & GENERIC_ALL) {
*pmode |= (S_IRWXUGO & (*pbits_to_set)); *pmode |= (S_IRWXUGO & (*pbits_to_set));
cFYI(DBG2, ("all perms")); cFYI(DBG2, "all perms");
return; return;
} }
if ((flags & GENERIC_WRITE) || if ((flags & GENERIC_WRITE) ||
@ -228,7 +228,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
*pmode |= (S_IXUGO & (*pbits_to_set)); *pmode |= (S_IXUGO & (*pbits_to_set));
cFYI(DBG2, ("access flags 0x%x mode now 0x%x", flags, *pmode)); cFYI(DBG2, "access flags 0x%x mode now 0x%x", flags, *pmode);
return; return;
} }
@ -257,7 +257,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
if (mode & S_IXUGO) if (mode & S_IXUGO)
*pace_flags |= SET_FILE_EXEC_RIGHTS; *pace_flags |= SET_FILE_EXEC_RIGHTS;
cFYI(DBG2, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags)); cFYI(DBG2, "mode: 0x%x, access flags now 0x%x", mode, *pace_flags);
return; return;
} }
@ -297,24 +297,24 @@ static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
/* validate that we do not go past end of acl */ /* validate that we do not go past end of acl */
if (le16_to_cpu(pace->size) < 16) { if (le16_to_cpu(pace->size) < 16) {
cERROR(1, ("ACE too small, %d", le16_to_cpu(pace->size))); cERROR(1, "ACE too small %d", le16_to_cpu(pace->size));
return; return;
} }
if (end_of_acl < (char *)pace + le16_to_cpu(pace->size)) { if (end_of_acl < (char *)pace + le16_to_cpu(pace->size)) {
cERROR(1, ("ACL too small to parse ACE")); cERROR(1, "ACL too small to parse ACE");
return; return;
} }
num_subauth = pace->sid.num_subauth; num_subauth = pace->sid.num_subauth;
if (num_subauth) { if (num_subauth) {
int i; int i;
cFYI(1, ("ACE revision %d num_auth %d type %d flags %d size %d", cFYI(1, "ACE revision %d num_auth %d type %d flags %d size %d",
pace->sid.revision, pace->sid.num_subauth, pace->type, pace->sid.revision, pace->sid.num_subauth, pace->type,
pace->flags, le16_to_cpu(pace->size))); pace->flags, le16_to_cpu(pace->size));
for (i = 0; i < num_subauth; ++i) { for (i = 0; i < num_subauth; ++i) {
cFYI(1, ("ACE sub_auth[%d]: 0x%x", i, cFYI(1, "ACE sub_auth[%d]: 0x%x", i,
le32_to_cpu(pace->sid.sub_auth[i]))); le32_to_cpu(pace->sid.sub_auth[i]));
} }
/* BB add length check to make sure that we do not have huge /* BB add length check to make sure that we do not have huge
@ -347,13 +347,13 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
/* validate that we do not go past end of acl */ /* validate that we do not go past end of acl */
if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
cERROR(1, ("ACL too small to parse DACL")); cERROR(1, "ACL too small to parse DACL");
return; return;
} }
cFYI(DBG2, ("DACL revision %d size %d num aces %d", cFYI(DBG2, "DACL revision %d size %d num aces %d",
le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
le32_to_cpu(pdacl->num_aces))); le32_to_cpu(pdacl->num_aces));
/* reset rwx permissions for user/group/other. /* reset rwx permissions for user/group/other.
Also, if num_aces is 0 i.e. DACL has no ACEs, Also, if num_aces is 0 i.e. DACL has no ACEs,
@ -437,25 +437,25 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
/* validate that we do not go past end of ACL - sid must be at least 8 /* validate that we do not go past end of ACL - sid must be at least 8
bytes long (assuming no sub-auths - e.g. the null SID */ bytes long (assuming no sub-auths - e.g. the null SID */
if (end_of_acl < (char *)psid + 8) { if (end_of_acl < (char *)psid + 8) {
cERROR(1, ("ACL too small to parse SID %p", psid)); cERROR(1, "ACL too small to parse SID %p", psid);
return -EINVAL; return -EINVAL;
} }
if (psid->num_subauth) { if (psid->num_subauth) {
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
int i; int i;
cFYI(1, ("SID revision %d num_auth %d", cFYI(1, "SID revision %d num_auth %d",
psid->revision, psid->num_subauth)); psid->revision, psid->num_subauth);
for (i = 0; i < psid->num_subauth; i++) { for (i = 0; i < psid->num_subauth; i++) {
cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, cFYI(1, "SID sub_auth[%d]: 0x%x ", i,
le32_to_cpu(psid->sub_auth[i]))); le32_to_cpu(psid->sub_auth[i]));
} }
/* BB add length check to make sure that we do not have huge /* BB add length check to make sure that we do not have huge
num auths and therefore go off the end */ num auths and therefore go off the end */
cFYI(1, ("RID 0x%x", cFYI(1, "RID 0x%x",
le32_to_cpu(psid->sub_auth[psid->num_subauth-1]))); le32_to_cpu(psid->sub_auth[psid->num_subauth-1]));
#endif #endif
} }
@ -482,11 +482,11 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
le32_to_cpu(pntsd->gsidoffset)); le32_to_cpu(pntsd->gsidoffset));
dacloffset = le32_to_cpu(pntsd->dacloffset); dacloffset = le32_to_cpu(pntsd->dacloffset);
dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);
cFYI(DBG2, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " cFYI(DBG2, "revision %d type 0x%x ooffset 0x%x goffset 0x%x "
"sacloffset 0x%x dacloffset 0x%x", "sacloffset 0x%x dacloffset 0x%x",
pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
le32_to_cpu(pntsd->gsidoffset), le32_to_cpu(pntsd->gsidoffset),
le32_to_cpu(pntsd->sacloffset), dacloffset)); le32_to_cpu(pntsd->sacloffset), dacloffset);
/* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ /* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */
rc = parse_sid(owner_sid_ptr, end_of_acl); rc = parse_sid(owner_sid_ptr, end_of_acl);
if (rc) if (rc)
@ -500,7 +500,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr,
group_sid_ptr, fattr); group_sid_ptr, fattr);
else else
cFYI(1, ("no ACL")); /* BB grant all or default perms? */ cFYI(1, "no ACL"); /* BB grant all or default perms? */
/* cifscred->uid = owner_sid_ptr->rid; /* cifscred->uid = owner_sid_ptr->rid;
cifscred->gid = group_sid_ptr->rid; cifscred->gid = group_sid_ptr->rid;
@ -563,7 +563,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
FreeXid(xid); FreeXid(xid);
cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
return pntsd; return pntsd;
} }
@ -581,12 +581,12 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
&fid, &oplock, NULL, cifs_sb->local_nls, &fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
cERROR(1, ("Unable to open file to get ACL")); cERROR(1, "Unable to open file to get ACL");
goto out; goto out;
} }
rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb->tcon, fid);
out: out:
@ -621,7 +621,7 @@ static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
FreeXid(xid); FreeXid(xid);
cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); cFYI(DBG2, "SetCIFSACL rc = %d", rc);
return rc; return rc;
} }
@ -638,12 +638,12 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
&fid, &oplock, NULL, cifs_sb->local_nls, &fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
cERROR(1, ("Unable to open file to set ACL")); cERROR(1, "Unable to open file to set ACL");
goto out; goto out;
} }
rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); cFYI(DBG2, "SetCIFSACL rc = %d", rc);
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb->tcon, fid);
out: out:
@ -659,7 +659,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
int rc; int rc;
cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode)); cFYI(DBG2, "set ACL for %s from mode 0x%x", path, inode->i_mode);
open_file = find_readable_file(CIFS_I(inode)); open_file = find_readable_file(CIFS_I(inode));
if (!open_file) if (!open_file)
@ -679,7 +679,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
u32 acllen = 0; u32 acllen = 0;
int rc = 0; int rc = 0;
cFYI(DBG2, ("converting ACL to mode for %s", path)); cFYI(DBG2, "converting ACL to mode for %s", path);
if (pfid) if (pfid)
pntsd = get_cifs_acl_by_fid(cifs_sb, *pfid, &acllen); pntsd = get_cifs_acl_by_fid(cifs_sb, *pfid, &acllen);
@ -690,7 +690,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
if (pntsd) if (pntsd)
rc = parse_sec_desc(pntsd, acllen, fattr); rc = parse_sec_desc(pntsd, acllen, fattr);
if (rc) if (rc)
cFYI(1, ("parse sec desc failed rc = %d", rc)); cFYI(1, "parse sec desc failed rc = %d", rc);
kfree(pntsd); kfree(pntsd);
return; return;
@ -704,7 +704,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
cFYI(DBG2, ("set ACL from mode for %s", path)); cFYI(DBG2, "set ACL from mode for %s", path);
/* Get the security descriptor */ /* Get the security descriptor */
pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen); pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen);
@ -721,19 +721,19 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
DEFSECDESCLEN : secdesclen; DEFSECDESCLEN : secdesclen;
pnntsd = kmalloc(secdesclen, GFP_KERNEL); pnntsd = kmalloc(secdesclen, GFP_KERNEL);
if (!pnntsd) { if (!pnntsd) {
cERROR(1, ("Unable to allocate security descriptor")); cERROR(1, "Unable to allocate security descriptor");
kfree(pntsd); kfree(pntsd);
return -ENOMEM; return -ENOMEM;
} }
rc = build_sec_desc(pntsd, pnntsd, inode, nmode); rc = build_sec_desc(pntsd, pnntsd, inode, nmode);
cFYI(DBG2, ("build_sec_desc rc: %d", rc)); cFYI(DBG2, "build_sec_desc rc: %d", rc);
if (!rc) { if (!rc) {
/* Set the security descriptor */ /* Set the security descriptor */
rc = set_cifs_acl(pnntsd, secdesclen, inode, path); rc = set_cifs_acl(pnntsd, secdesclen, inode, path);
cFYI(DBG2, ("set_cifs_acl rc: %d", rc)); cFYI(DBG2, "set_cifs_acl rc: %d", rc);
} }
kfree(pnntsd); kfree(pnntsd);

View file

@ -103,7 +103,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
if (iov[i].iov_len == 0) if (iov[i].iov_len == 0)
continue; continue;
if (iov[i].iov_base == NULL) { if (iov[i].iov_base == NULL) {
cERROR(1, ("null iovec entry")); cERROR(1, "null iovec entry");
return -EIO; return -EIO;
} }
/* The first entry includes a length field (which does not get /* The first entry includes a length field (which does not get
@ -181,8 +181,8 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
/* Do not need to verify session setups with signature "BSRSPYL " */ /* Do not need to verify session setups with signature "BSRSPYL " */
if (memcmp(cifs_pdu->Signature.SecuritySignature, "BSRSPYL ", 8) == 0) if (memcmp(cifs_pdu->Signature.SecuritySignature, "BSRSPYL ", 8) == 0)
cFYI(1, ("dummy signature received for smb command 0x%x", cFYI(1, "dummy signature received for smb command 0x%x",
cifs_pdu->Command)); cifs_pdu->Command);
/* save off the origiginal signature so we can modify the smb and check /* save off the origiginal signature so we can modify the smb and check
its signature against what the server sent */ its signature against what the server sent */
@ -291,7 +291,7 @@ void calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt,
if (password) if (password)
strncpy(password_with_pad, password, CIFS_ENCPWD_SIZE); strncpy(password_with_pad, password, CIFS_ENCPWD_SIZE);
if (!encrypt && extended_security & CIFSSEC_MAY_PLNTXT) { if (!encrypt && global_secflags & CIFSSEC_MAY_PLNTXT) {
memset(lnm_session_key, 0, CIFS_SESS_KEY_SIZE); memset(lnm_session_key, 0, CIFS_SESS_KEY_SIZE);
memcpy(lnm_session_key, password_with_pad, memcpy(lnm_session_key, password_with_pad,
CIFS_ENCPWD_SIZE); CIFS_ENCPWD_SIZE);
@ -398,7 +398,7 @@ void setup_ntlmv2_rsp(struct cifsSesInfo *ses, char *resp_buf,
/* calculate buf->ntlmv2_hash */ /* calculate buf->ntlmv2_hash */
rc = calc_ntlmv2_hash(ses, nls_cp); rc = calc_ntlmv2_hash(ses, nls_cp);
if (rc) if (rc)
cERROR(1, ("could not get v2 hash rc %d", rc)); cERROR(1, "could not get v2 hash rc %d", rc);
CalcNTLMv2_response(ses, resp_buf); CalcNTLMv2_response(ses, resp_buf);
/* now calculate the MAC key for NTLMv2 */ /* now calculate the MAC key for NTLMv2 */

View file

@ -49,10 +49,6 @@
#include "cifs_spnego.h" #include "cifs_spnego.h"
#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */
#ifdef CONFIG_CIFS_QUOTA
static const struct quotactl_ops cifs_quotactl_ops;
#endif /* QUOTA */
int cifsFYI = 0; int cifsFYI = 0;
int cifsERROR = 1; int cifsERROR = 1;
int traceSMB = 0; int traceSMB = 0;
@ -61,7 +57,7 @@ unsigned int experimEnabled = 0;
unsigned int linuxExtEnabled = 1; unsigned int linuxExtEnabled = 1;
unsigned int lookupCacheEnabled = 1; unsigned int lookupCacheEnabled = 1;
unsigned int multiuser_mount = 0; unsigned int multiuser_mount = 0;
unsigned int extended_security = CIFSSEC_DEF; unsigned int global_secflags = CIFSSEC_DEF;
/* unsigned int ntlmv2_support = 0; */ /* unsigned int ntlmv2_support = 0; */
unsigned int sign_CIFS_PDUs = 1; unsigned int sign_CIFS_PDUs = 1;
static const struct super_operations cifs_super_ops; static const struct super_operations cifs_super_ops;
@ -86,8 +82,6 @@ extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp; extern mempool_t *cifs_mid_poolp;
extern struct kmem_cache *cifs_oplock_cachep;
static int static int
cifs_read_super(struct super_block *sb, void *data, cifs_read_super(struct super_block *sb, void *data,
const char *devname, int silent) const char *devname, int silent)
@ -135,8 +129,7 @@ cifs_read_super(struct super_block *sb, void *data,
if (rc) { if (rc) {
if (!silent) if (!silent)
cERROR(1, cERROR(1, "cifs_mount failed w/return code = %d", rc);
("cifs_mount failed w/return code = %d", rc));
goto out_mount_failed; goto out_mount_failed;
} }
@ -146,9 +139,6 @@ cifs_read_super(struct super_block *sb, void *data,
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize = sb->s_blocksize =
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
#ifdef CONFIG_CIFS_QUOTA
sb->s_qcop = &cifs_quotactl_ops;
#endif
sb->s_blocksize = CIFS_MAX_MSGSIZE; sb->s_blocksize = CIFS_MAX_MSGSIZE;
sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */
inode = cifs_root_iget(sb, ROOT_I); inode = cifs_root_iget(sb, ROOT_I);
@ -168,7 +158,7 @@ cifs_read_super(struct super_block *sb, void *data,
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
cFYI(1, ("export ops supported")); cFYI(1, "export ops supported");
sb->s_export_op = &cifs_export_ops; sb->s_export_op = &cifs_export_ops;
} }
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
@ -176,7 +166,7 @@ cifs_read_super(struct super_block *sb, void *data,
return 0; return 0;
out_no_root: out_no_root:
cERROR(1, ("cifs_read_super: get root inode failed")); cERROR(1, "cifs_read_super: get root inode failed");
if (inode) if (inode)
iput(inode); iput(inode);
@ -203,10 +193,10 @@ cifs_put_super(struct super_block *sb)
int rc = 0; int rc = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
cFYI(1, ("In cifs_put_super")); cFYI(1, "In cifs_put_super");
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
if (cifs_sb == NULL) { if (cifs_sb == NULL) {
cFYI(1, ("Empty cifs superblock info passed to unmount")); cFYI(1, "Empty cifs superblock info passed to unmount");
return; return;
} }
@ -214,7 +204,7 @@ cifs_put_super(struct super_block *sb)
rc = cifs_umount(sb, cifs_sb); rc = cifs_umount(sb, cifs_sb);
if (rc) if (rc)
cERROR(1, ("cifs_umount failed with return code %d", rc)); cERROR(1, "cifs_umount failed with return code %d", rc);
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
if (cifs_sb->mountdata) { if (cifs_sb->mountdata) {
kfree(cifs_sb->mountdata); kfree(cifs_sb->mountdata);
@ -300,7 +290,6 @@ static int cifs_permission(struct inode *inode, int mask)
static struct kmem_cache *cifs_inode_cachep; static struct kmem_cache *cifs_inode_cachep;
static struct kmem_cache *cifs_req_cachep; static struct kmem_cache *cifs_req_cachep;
static struct kmem_cache *cifs_mid_cachep; static struct kmem_cache *cifs_mid_cachep;
struct kmem_cache *cifs_oplock_cachep;
static struct kmem_cache *cifs_sm_req_cachep; static struct kmem_cache *cifs_sm_req_cachep;
mempool_t *cifs_sm_req_poolp; mempool_t *cifs_sm_req_poolp;
mempool_t *cifs_req_poolp; mempool_t *cifs_req_poolp;
@ -432,106 +421,6 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
return 0; return 0;
} }
#ifdef CONFIG_CIFS_QUOTA
int cifs_xquota_set(struct super_block *sb, int quota_type, qid_t qid,
struct fs_disk_quota *pdquota)
{
int xid;
int rc = 0;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *pTcon;
if (cifs_sb)
pTcon = cifs_sb->tcon;
else
return -EIO;
xid = GetXid();
if (pTcon) {
cFYI(1, ("set type: 0x%x id: %d", quota_type, qid));
} else
rc = -EIO;
FreeXid(xid);
return rc;
}
int cifs_xquota_get(struct super_block *sb, int quota_type, qid_t qid,
struct fs_disk_quota *pdquota)
{
int xid;
int rc = 0;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *pTcon;
if (cifs_sb)
pTcon = cifs_sb->tcon;
else
return -EIO;
xid = GetXid();
if (pTcon) {
cFYI(1, ("set type: 0x%x id: %d", quota_type, qid));
} else
rc = -EIO;
FreeXid(xid);
return rc;
}
int cifs_xstate_set(struct super_block *sb, unsigned int flags, int operation)
{
int xid;
int rc = 0;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *pTcon;
if (cifs_sb)
pTcon = cifs_sb->tcon;
else
return -EIO;
xid = GetXid();
if (pTcon) {
cFYI(1, ("flags: 0x%x operation: 0x%x", flags, operation));
} else
rc = -EIO;
FreeXid(xid);
return rc;
}
int cifs_xstate_get(struct super_block *sb, struct fs_quota_stat *qstats)
{
int xid;
int rc = 0;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *pTcon;
if (cifs_sb)
pTcon = cifs_sb->tcon;
else
return -EIO;
xid = GetXid();
if (pTcon) {
cFYI(1, ("pqstats %p", qstats));
} else
rc = -EIO;
FreeXid(xid);
return rc;
}
static const struct quotactl_ops cifs_quotactl_ops = {
.set_xquota = cifs_xquota_set,
.get_xquota = cifs_xquota_get,
.set_xstate = cifs_xstate_set,
.get_xstate = cifs_xstate_get,
};
#endif
static void cifs_umount_begin(struct super_block *sb) static void cifs_umount_begin(struct super_block *sb)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@ -558,7 +447,7 @@ static void cifs_umount_begin(struct super_block *sb)
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ /* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
/* cancel_notify_requests(tcon); */ /* cancel_notify_requests(tcon); */
if (tcon->ses && tcon->ses->server) { if (tcon->ses && tcon->ses->server) {
cFYI(1, ("wake up tasks now - umount begin not complete")); cFYI(1, "wake up tasks now - umount begin not complete");
wake_up_all(&tcon->ses->server->request_q); wake_up_all(&tcon->ses->server->request_q);
wake_up_all(&tcon->ses->server->response_q); wake_up_all(&tcon->ses->server->response_q);
msleep(1); /* yield */ msleep(1); /* yield */
@ -609,7 +498,7 @@ cifs_get_sb(struct file_system_type *fs_type,
int rc; int rc;
struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL);
cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
if (IS_ERR(sb)) if (IS_ERR(sb))
return PTR_ERR(sb); return PTR_ERR(sb);
@ -656,7 +545,6 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
return generic_file_llseek_unlocked(file, offset, origin); return generic_file_llseek_unlocked(file, offset, origin);
} }
#ifdef CONFIG_CIFS_EXPERIMENTAL
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
{ {
/* note that this is called by vfs setlease with the BKL held /* note that this is called by vfs setlease with the BKL held
@ -685,7 +573,6 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
else else
return -EAGAIN; return -EAGAIN;
} }
#endif
struct file_system_type cifs_fs_type = { struct file_system_type cifs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
@ -762,10 +649,7 @@ const struct file_operations cifs_file_ops = {
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
#ifdef CONFIG_CIFS_EXPERIMENTAL
.setlease = cifs_setlease, .setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
}; };
const struct file_operations cifs_file_direct_ops = { const struct file_operations cifs_file_direct_ops = {
@ -784,9 +668,7 @@ const struct file_operations cifs_file_direct_ops = {
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
.llseek = cifs_llseek, .llseek = cifs_llseek,
#ifdef CONFIG_CIFS_EXPERIMENTAL
.setlease = cifs_setlease, .setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
}; };
const struct file_operations cifs_file_nobrl_ops = { const struct file_operations cifs_file_nobrl_ops = {
.read = do_sync_read, .read = do_sync_read,
@ -803,10 +685,7 @@ const struct file_operations cifs_file_nobrl_ops = {
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
#ifdef CONFIG_CIFS_EXPERIMENTAL
.setlease = cifs_setlease, .setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
}; };
const struct file_operations cifs_file_direct_nobrl_ops = { const struct file_operations cifs_file_direct_nobrl_ops = {
@ -824,9 +703,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
.llseek = cifs_llseek, .llseek = cifs_llseek,
#ifdef CONFIG_CIFS_EXPERIMENTAL
.setlease = cifs_setlease, .setlease = cifs_setlease,
#endif /* CONFIG_CIFS_EXPERIMENTAL */
}; };
const struct file_operations cifs_dir_ops = { const struct file_operations cifs_dir_ops = {
@ -878,7 +755,7 @@ cifs_init_request_bufs(void)
} else { } else {
CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/ CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
} }
/* cERROR(1,("CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize)); */ /* cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */
cifs_req_cachep = kmem_cache_create("cifs_request", cifs_req_cachep = kmem_cache_create("cifs_request",
CIFSMaxBufSize + CIFSMaxBufSize +
MAX_CIFS_HDR_SIZE, 0, MAX_CIFS_HDR_SIZE, 0,
@ -890,7 +767,7 @@ cifs_init_request_bufs(void)
cifs_min_rcv = 1; cifs_min_rcv = 1;
else if (cifs_min_rcv > 64) { else if (cifs_min_rcv > 64) {
cifs_min_rcv = 64; cifs_min_rcv = 64;
cERROR(1, ("cifs_min_rcv set to maximum (64)")); cERROR(1, "cifs_min_rcv set to maximum (64)");
} }
cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv, cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv,
@ -921,7 +798,7 @@ cifs_init_request_bufs(void)
cifs_min_small = 2; cifs_min_small = 2;
else if (cifs_min_small > 256) { else if (cifs_min_small > 256) {
cifs_min_small = 256; cifs_min_small = 256;
cFYI(1, ("cifs_min_small set to maximum (256)")); cFYI(1, "cifs_min_small set to maximum (256)");
} }
cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small, cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small,
@ -962,15 +839,6 @@ cifs_init_mids(void)
return -ENOMEM; return -ENOMEM;
} }
cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs",
sizeof(struct oplock_q_entry), 0,
SLAB_HWCACHE_ALIGN, NULL);
if (cifs_oplock_cachep == NULL) {
mempool_destroy(cifs_mid_poolp);
kmem_cache_destroy(cifs_mid_cachep);
return -ENOMEM;
}
return 0; return 0;
} }
@ -979,7 +847,6 @@ cifs_destroy_mids(void)
{ {
mempool_destroy(cifs_mid_poolp); mempool_destroy(cifs_mid_poolp);
kmem_cache_destroy(cifs_mid_cachep); kmem_cache_destroy(cifs_mid_cachep);
kmem_cache_destroy(cifs_oplock_cachep);
} }
static int __init static int __init
@ -1019,10 +886,10 @@ init_cifs(void)
if (cifs_max_pending < 2) { if (cifs_max_pending < 2) {
cifs_max_pending = 2; cifs_max_pending = 2;
cFYI(1, ("cifs_max_pending set to min of 2")); cFYI(1, "cifs_max_pending set to min of 2");
} else if (cifs_max_pending > 256) { } else if (cifs_max_pending > 256) {
cifs_max_pending = 256; cifs_max_pending = 256;
cFYI(1, ("cifs_max_pending set to max of 256")); cFYI(1, "cifs_max_pending set to max of 256");
} }
rc = cifs_init_inodecache(); rc = cifs_init_inodecache();
@ -1080,7 +947,7 @@ init_cifs(void)
static void __exit static void __exit
exit_cifs(void) exit_cifs(void)
{ {
cFYI(DBG2, ("exit_cifs")); cFYI(DBG2, "exit_cifs");
cifs_proc_clean(); cifs_proc_clean();
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
cifs_dfs_release_automount_timer(); cifs_dfs_release_automount_timer();

View file

@ -114,5 +114,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
extern const struct export_operations cifs_export_ops; extern const struct export_operations cifs_export_ops;
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
#define CIFS_VERSION "1.62" #define CIFS_VERSION "1.64"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */

View file

@ -87,7 +87,6 @@ enum securityEnum {
RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */ RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */
/* NTLMSSP, */ /* can use rawNTLMSSP instead of NTLMSSP via SPNEGO */ /* NTLMSSP, */ /* can use rawNTLMSSP instead of NTLMSSP via SPNEGO */
Kerberos, /* Kerberos via SPNEGO */ Kerberos, /* Kerberos via SPNEGO */
MSKerberos, /* MS Kerberos via SPNEGO */
}; };
enum protocolEnum { enum protocolEnum {
@ -185,6 +184,12 @@ struct TCP_Server_Info {
struct mac_key mac_signing_key; struct mac_key mac_signing_key;
char ntlmv2_hash[16]; char ntlmv2_hash[16];
unsigned long lstrp; /* when we got last response from this server */ unsigned long lstrp; /* when we got last response from this server */
u16 dialect; /* dialect index that server chose */
/* extended security flavors that server supports */
bool sec_kerberos; /* supports plain Kerberos */
bool sec_mskerberos; /* supports legacy MS Kerberos */
bool sec_kerberosu2u; /* supports U2U Kerberos */
bool sec_ntlmssp; /* supports NTLMSSP */
}; };
/* /*
@ -718,7 +723,7 @@ GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions
GLOBAL_EXTERN unsigned int oplockEnabled; GLOBAL_EXTERN unsigned int oplockEnabled;
GLOBAL_EXTERN unsigned int experimEnabled; GLOBAL_EXTERN unsigned int experimEnabled;
GLOBAL_EXTERN unsigned int lookupCacheEnabled; GLOBAL_EXTERN unsigned int lookupCacheEnabled;
GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent GLOBAL_EXTERN unsigned int global_secflags; /* if on, session setup sent
with more secure ntlmssp2 challenge/resp */ with more secure ntlmssp2 challenge/resp */
GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */ GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */
GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/ GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/

View file

@ -39,8 +39,20 @@ extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
unsigned int /* length */); unsigned int /* length */);
extern unsigned int _GetXid(void); extern unsigned int _GetXid(void);
extern void _FreeXid(unsigned int); extern void _FreeXid(unsigned int);
#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid())); #define GetXid() \
#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));} ({ \
int __xid = (int)_GetXid(); \
cFYI(1, "CIFS VFS: in %s as Xid: %d with uid: %d", \
__func__, __xid, current_fsuid()); \
__xid; \
})
#define FreeXid(curr_xid) \
do { \
_FreeXid(curr_xid); \
cFYI(1, "CIFS VFS: leaving %s (xid = %d) rc = %d", \
__func__, curr_xid, (int)rc); \
} while (0)
extern char *build_path_from_dentry(struct dentry *); extern char *build_path_from_dentry(struct dentry *);
extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb); extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb);
extern char *build_wildcard_path_from_dentry(struct dentry *direntry); extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
@ -73,7 +85,7 @@ extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *);
extern unsigned int smbCalcSize(struct smb_hdr *ptr); extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length, extern int decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType); struct TCP_Server_Info *server);
extern int cifs_convert_address(char *src, void *dst); extern int cifs_convert_address(char *src, void *dst);
extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr);
extern void header_assemble(struct smb_hdr *, char /* command */ , extern void header_assemble(struct smb_hdr *, char /* command */ ,
@ -83,7 +95,6 @@ extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
struct cifsSesInfo *ses, struct cifsSesInfo *ses,
void **request_buf); void **request_buf);
extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
const int stage,
const struct nls_table *nls_cp); const struct nls_table *nls_cp);
extern __u16 GetNextMid(struct TCP_Server_Info *server); extern __u16 GetNextMid(struct TCP_Server_Info *server);
extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
@ -95,8 +106,11 @@ extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
__u16 fileHandle, struct file *file, __u16 fileHandle, struct file *file,
struct vfsmount *mnt, unsigned int oflags); struct vfsmount *mnt, unsigned int oflags);
extern int cifs_posix_open(char *full_path, struct inode **pinode, extern int cifs_posix_open(char *full_path, struct inode **pinode,
struct vfsmount *mnt, int mode, int oflags, struct vfsmount *mnt,
__u32 *poplock, __u16 *pnetfid, int xid); struct super_block *sb,
int mode, int oflags,
__u32 *poplock, __u16 *pnetfid, int xid);
void cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
FILE_UNIX_BASIC_INFO *info, FILE_UNIX_BASIC_INFO *info,
struct cifs_sb_info *cifs_sb); struct cifs_sb_info *cifs_sb);
@ -125,7 +139,9 @@ extern void cifs_dfs_release_automount_timer(void);
void cifs_proc_init(void); void cifs_proc_init(void);
void cifs_proc_clean(void); void cifs_proc_clean(void);
extern int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, extern int cifs_negotiate_protocol(unsigned int xid,
struct cifsSesInfo *ses);
extern int cifs_setup_session(unsigned int xid, struct cifsSesInfo *ses,
struct nls_table *nls_info); struct nls_table *nls_info);
extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses); extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -73,7 +73,7 @@ cifs_bp_rename_retry:
namelen += (1 + temp->d_name.len); namelen += (1 + temp->d_name.len);
temp = temp->d_parent; temp = temp->d_parent;
if (temp == NULL) { if (temp == NULL) {
cERROR(1, ("corrupt dentry")); cERROR(1, "corrupt dentry");
return NULL; return NULL;
} }
} }
@ -90,19 +90,18 @@ cifs_bp_rename_retry:
full_path[namelen] = dirsep; full_path[namelen] = dirsep;
strncpy(full_path + namelen + 1, temp->d_name.name, strncpy(full_path + namelen + 1, temp->d_name.name,
temp->d_name.len); temp->d_name.len);
cFYI(0, ("name: %s", full_path + namelen)); cFYI(0, "name: %s", full_path + namelen);
} }
temp = temp->d_parent; temp = temp->d_parent;
if (temp == NULL) { if (temp == NULL) {
cERROR(1, ("corrupt dentry")); cERROR(1, "corrupt dentry");
kfree(full_path); kfree(full_path);
return NULL; return NULL;
} }
} }
if (namelen != pplen + dfsplen) { if (namelen != pplen + dfsplen) {
cERROR(1, cERROR(1, "did not end path lookup where expected namelen is %d",
("did not end path lookup where expected namelen is %d", namelen);
namelen));
/* presumably this is only possible if racing with a rename /* presumably this is only possible if racing with a rename
of one of the parent directories (we can not lock the dentries of one of the parent directories (we can not lock the dentries
above us to prevent this, but retrying should be harmless) */ above us to prevent this, but retrying should be harmless) */
@ -130,6 +129,12 @@ cifs_bp_rename_retry:
return full_path; return full_path;
} }
/*
* When called with struct file pointer set to NULL, there is no way we could
* update file->private_data, but getting it stuck on openFileList provides a
* way to access it from cifs_fill_filedata and thereby set file->private_data
* from cifs_open.
*/
struct cifsFileInfo * struct cifsFileInfo *
cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
struct file *file, struct vfsmount *mnt, unsigned int oflags) struct file *file, struct vfsmount *mnt, unsigned int oflags)
@ -173,7 +178,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock inode %p", newinode)); cFYI(1, "Exclusive Oplock inode %p", newinode);
} else if ((oplock & 0xF) == OPLOCK_READ) } else if ((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
} }
@ -183,16 +188,17 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
} }
int cifs_posix_open(char *full_path, struct inode **pinode, int cifs_posix_open(char *full_path, struct inode **pinode,
struct vfsmount *mnt, int mode, int oflags, struct vfsmount *mnt, struct super_block *sb,
__u32 *poplock, __u16 *pnetfid, int xid) int mode, int oflags,
__u32 *poplock, __u16 *pnetfid, int xid)
{ {
int rc; int rc;
FILE_UNIX_BASIC_INFO *presp_data; FILE_UNIX_BASIC_INFO *presp_data;
__u32 posix_flags = 0; __u32 posix_flags = 0;
struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifs_fattr fattr; struct cifs_fattr fattr;
cFYI(1, ("posix open %s", full_path)); cFYI(1, "posix open %s", full_path);
presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
if (presp_data == NULL) if (presp_data == NULL)
@ -242,7 +248,8 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
/* get new inode and set it up */ /* get new inode and set it up */
if (*pinode == NULL) { if (*pinode == NULL) {
*pinode = cifs_iget(mnt->mnt_sb, &fattr); cifs_fill_uniqueid(sb, &fattr);
*pinode = cifs_iget(sb, &fattr);
if (!*pinode) { if (!*pinode) {
rc = -ENOMEM; rc = -ENOMEM;
goto posix_open_ret; goto posix_open_ret;
@ -251,7 +258,18 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
cifs_fattr_to_inode(*pinode, &fattr); cifs_fattr_to_inode(*pinode, &fattr);
} }
cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags); /*
* cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
* file->private_data.
*/
if (mnt) {
struct cifsFileInfo *pfile_info;
pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
oflags);
if (pfile_info == NULL)
rc = -ENOMEM;
}
posix_open_ret: posix_open_ret:
kfree(presp_data); kfree(presp_data);
@ -315,13 +333,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
if (nd && (nd->flags & LOOKUP_OPEN)) if (nd && (nd->flags & LOOKUP_OPEN))
oflags = nd->intent.open.flags; oflags = nd->intent.open.flags;
else else
oflags = FMODE_READ; oflags = FMODE_READ | SMB_O_CREAT;
if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP & (CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
rc = cifs_posix_open(full_path, &newinode, nd->path.mnt, rc = cifs_posix_open(full_path, &newinode,
mode, oflags, &oplock, &fileHandle, xid); nd ? nd->path.mnt : NULL,
inode->i_sb, mode, oflags, &oplock, &fileHandle, xid);
/* EIO could indicate that (posix open) operation is not /* EIO could indicate that (posix open) operation is not
supported, despite what server claimed in capability supported, despite what server claimed in capability
negotation. EREMOTE indicates DFS junction, which is not negotation. EREMOTE indicates DFS junction, which is not
@ -358,7 +377,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
else if ((oflags & O_CREAT) == O_CREAT) else if ((oflags & O_CREAT) == O_CREAT)
disposition = FILE_OPEN_IF; disposition = FILE_OPEN_IF;
else else
cFYI(1, ("Create flag not set in create function")); cFYI(1, "Create flag not set in create function");
} }
/* BB add processing to set equivalent of mode - e.g. via CreateX with /* BB add processing to set equivalent of mode - e.g. via CreateX with
@ -394,7 +413,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
} }
if (rc) { if (rc) {
cFYI(1, ("cifs_create returned 0x%x", rc)); cFYI(1, "cifs_create returned 0x%x", rc);
goto cifs_create_out; goto cifs_create_out;
} }
@ -457,15 +476,22 @@ cifs_create_set_dentry:
if (rc == 0) if (rc == 0)
setup_cifs_dentry(tcon, direntry, newinode); setup_cifs_dentry(tcon, direntry, newinode);
else else
cFYI(1, ("Create worked, get_inode_info failed rc = %d", rc)); cFYI(1, "Create worked, get_inode_info failed rc = %d", rc);
/* nfsd case - nfs srv does not set nd */ /* nfsd case - nfs srv does not set nd */
if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) { if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) {
/* mknod case - do not leave file open */ /* mknod case - do not leave file open */
CIFSSMBClose(xid, tcon, fileHandle); CIFSSMBClose(xid, tcon, fileHandle);
} else if (!(posix_create) && (newinode)) { } else if (!(posix_create) && (newinode)) {
cifs_new_fileinfo(newinode, fileHandle, NULL, struct cifsFileInfo *pfile_info;
nd->path.mnt, oflags); /*
* cifs_fill_filedata() takes care of setting cifsFileInfo
* pointer to file->private_data.
*/
pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL,
nd->path.mnt, oflags);
if (pfile_info == NULL)
rc = -ENOMEM;
} }
cifs_create_out: cifs_create_out:
kfree(buf); kfree(buf);
@ -531,7 +557,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
u16 fileHandle; u16 fileHandle;
FILE_ALL_INFO *buf; FILE_ALL_INFO *buf;
cFYI(1, ("sfu compat create special file")); cFYI(1, "sfu compat create special file");
buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
if (buf == NULL) { if (buf == NULL) {
@ -616,8 +642,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
xid = GetXid(); xid = GetXid();
cFYI(1, ("parent inode = 0x%p name is: %s and dentry = 0x%p", cFYI(1, "parent inode = 0x%p name is: %s and dentry = 0x%p",
parent_dir_inode, direntry->d_name.name, direntry)); parent_dir_inode, direntry->d_name.name, direntry);
/* check whether path exists */ /* check whether path exists */
@ -632,7 +658,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
int i; int i;
for (i = 0; i < direntry->d_name.len; i++) for (i = 0; i < direntry->d_name.len; i++)
if (direntry->d_name.name[i] == '\\') { if (direntry->d_name.name[i] == '\\') {
cFYI(1, ("Invalid file name")); cFYI(1, "Invalid file name");
FreeXid(xid); FreeXid(xid);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
@ -657,11 +683,11 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
} }
if (direntry->d_inode != NULL) { if (direntry->d_inode != NULL) {
cFYI(1, ("non-NULL inode in lookup")); cFYI(1, "non-NULL inode in lookup");
} else { } else {
cFYI(1, ("NULL inode in lookup")); cFYI(1, "NULL inode in lookup");
} }
cFYI(1, ("Full path: %s inode = 0x%p", full_path, direntry->d_inode)); cFYI(1, "Full path: %s inode = 0x%p", full_path, direntry->d_inode);
/* Posix open is only called (at lookup time) for file create now. /* Posix open is only called (at lookup time) for file create now.
* For opens (rather than creates), because we do not know if it * For opens (rather than creates), because we do not know if it
@ -678,6 +704,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
(nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
(nd->intent.open.flags & O_CREAT)) { (nd->intent.open.flags & O_CREAT)) {
rc = cifs_posix_open(full_path, &newInode, nd->path.mnt, rc = cifs_posix_open(full_path, &newInode, nd->path.mnt,
parent_dir_inode->i_sb,
nd->intent.open.create_mode, nd->intent.open.create_mode,
nd->intent.open.flags, &oplock, nd->intent.open.flags, &oplock,
&fileHandle, xid); &fileHandle, xid);
@ -723,7 +750,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
/* if it was once a directory (but how can we tell?) we could do /* if it was once a directory (but how can we tell?) we could do
shrink_dcache_parent(direntry); */ shrink_dcache_parent(direntry); */
} else if (rc != -EACCES) { } else if (rc != -EACCES) {
cERROR(1, ("Unexpected lookup error %d", rc)); cERROR(1, "Unexpected lookup error %d", rc);
/* We special case check for Access Denied - since that /* We special case check for Access Denied - since that
is a common return code */ is a common return code */
} }
@ -742,8 +769,8 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
if (cifs_revalidate_dentry(direntry)) if (cifs_revalidate_dentry(direntry))
return 0; return 0;
} else { } else {
cFYI(1, ("neg dentry 0x%p name = %s", cFYI(1, "neg dentry 0x%p name = %s",
direntry, direntry->d_name.name)); direntry, direntry->d_name.name);
if (time_after(jiffies, direntry->d_time + HZ) || if (time_after(jiffies, direntry->d_time + HZ) ||
!lookupCacheEnabled) { !lookupCacheEnabled) {
d_drop(direntry); d_drop(direntry);
@ -758,7 +785,7 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
{ {
int rc = 0; int rc = 0;
cFYI(1, ("In cifs d_delete, name = %s", direntry->d_name.name)); cFYI(1, "In cifs d_delete, name = %s", direntry->d_name.name);
return rc; return rc;
} */ } */

View file

@ -106,14 +106,14 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
/* search for server name delimiter */ /* search for server name delimiter */
len = strlen(unc); len = strlen(unc);
if (len < 3) { if (len < 3) {
cFYI(1, ("%s: unc is too short: %s", __func__, unc)); cFYI(1, "%s: unc is too short: %s", __func__, unc);
return -EINVAL; return -EINVAL;
} }
len -= 2; len -= 2;
name = memchr(unc+2, '\\', len); name = memchr(unc+2, '\\', len);
if (!name) { if (!name) {
cFYI(1, ("%s: probably server name is whole unc: %s", cFYI(1, "%s: probably server name is whole unc: %s",
__func__, unc)); __func__, unc);
} else { } else {
len = (name - unc) - 2/* leading // */; len = (name - unc) - 2/* leading // */;
} }
@ -127,8 +127,8 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
name[len] = 0; name[len] = 0;
if (is_ip(name)) { if (is_ip(name)) {
cFYI(1, ("%s: it is IP, skipping dns upcall: %s", cFYI(1, "%s: it is IP, skipping dns upcall: %s",
__func__, name)); __func__, name);
data = name; data = name;
goto skip_upcall; goto skip_upcall;
} }
@ -138,7 +138,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
len = rkey->type_data.x[0]; len = rkey->type_data.x[0];
data = rkey->payload.data; data = rkey->payload.data;
} else { } else {
cERROR(1, ("%s: unable to resolve: %s", __func__, name)); cERROR(1, "%s: unable to resolve: %s", __func__, name);
goto out; goto out;
} }
@ -148,10 +148,10 @@ skip_upcall:
if (*ip_addr) { if (*ip_addr) {
memcpy(*ip_addr, data, len + 1); memcpy(*ip_addr, data, len + 1);
if (!IS_ERR(rkey)) if (!IS_ERR(rkey))
cFYI(1, ("%s: resolved: %s to %s", __func__, cFYI(1, "%s: resolved: %s to %s", __func__,
name, name,
*ip_addr *ip_addr
)); );
rc = 0; rc = 0;
} else { } else {
rc = -ENOMEM; rc = -ENOMEM;

View file

@ -49,7 +49,7 @@
static struct dentry *cifs_get_parent(struct dentry *dentry) static struct dentry *cifs_get_parent(struct dentry *dentry)
{ {
/* BB need to add code here eventually to enable export via NFSD */ /* BB need to add code here eventually to enable export via NFSD */
cFYI(1, ("get parent for %p", dentry)); cFYI(1, "get parent for %p", dentry);
return ERR_PTR(-EACCES); return ERR_PTR(-EACCES);
} }

View file

@ -3,7 +3,7 @@
* *
* vfs operations that deal with files * vfs operations that deal with files
* *
* Copyright (C) International Business Machines Corp., 2002,2007 * Copyright (C) International Business Machines Corp., 2002,2010
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org) * Jeremy Allison (jra@samba.org)
* *
@ -108,8 +108,7 @@ static inline int cifs_get_disposition(unsigned int flags)
/* all arguments to this function must be checked for validity in caller */ /* all arguments to this function must be checked for validity in caller */
static inline int static inline int
cifs_posix_open_inode_helper(struct inode *inode, struct file *file, cifs_posix_open_inode_helper(struct inode *inode, struct file *file,
struct cifsInodeInfo *pCifsInode, struct cifsInodeInfo *pCifsInode, __u32 oplock,
struct cifsFileInfo *pCifsFile, __u32 oplock,
u16 netfid) u16 netfid)
{ {
@ -136,15 +135,15 @@ cifs_posix_open_inode_helper(struct inode *inode, struct file *file,
if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&
(file->f_path.dentry->d_inode->i_size == (file->f_path.dentry->d_inode->i_size ==
(loff_t)le64_to_cpu(buf->EndOfFile))) { (loff_t)le64_to_cpu(buf->EndOfFile))) {
cFYI(1, ("inode unchanged on server")); cFYI(1, "inode unchanged on server");
} else { } else {
if (file->f_path.dentry->d_inode->i_mapping) { if (file->f_path.dentry->d_inode->i_mapping) {
rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
if (rc != 0) if (rc != 0)
CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc;
} }
cFYI(1, ("invalidating remote inode since open detected it " cFYI(1, "invalidating remote inode since open detected it "
"changed")); "changed");
invalidate_remote_inode(file->f_path.dentry->d_inode); invalidate_remote_inode(file->f_path.dentry->d_inode);
} */ } */
@ -152,8 +151,8 @@ psx_client_can_cache:
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock granted on inode %p", cFYI(1, "Exclusive Oplock granted on inode %p",
file->f_path.dentry->d_inode)); file->f_path.dentry->d_inode);
} else if ((oplock & 0xF) == OPLOCK_READ) } else if ((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
@ -190,8 +189,8 @@ cifs_fill_filedata(struct file *file)
if (file->private_data != NULL) { if (file->private_data != NULL) {
return pCifsFile; return pCifsFile;
} else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL))
cERROR(1, ("could not find file instance for " cERROR(1, "could not find file instance for "
"new file %p", file)); "new file %p", file);
return NULL; return NULL;
} }
@ -217,7 +216,7 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&
(file->f_path.dentry->d_inode->i_size == (file->f_path.dentry->d_inode->i_size ==
(loff_t)le64_to_cpu(buf->EndOfFile))) { (loff_t)le64_to_cpu(buf->EndOfFile))) {
cFYI(1, ("inode unchanged on server")); cFYI(1, "inode unchanged on server");
} else { } else {
if (file->f_path.dentry->d_inode->i_mapping) { if (file->f_path.dentry->d_inode->i_mapping) {
/* BB no need to lock inode until after invalidate /* 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,
if (rc != 0) if (rc != 0)
CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc;
} }
cFYI(1, ("invalidating remote inode since open detected it " cFYI(1, "invalidating remote inode since open detected it "
"changed")); "changed");
invalidate_remote_inode(file->f_path.dentry->d_inode); invalidate_remote_inode(file->f_path.dentry->d_inode);
} }
@ -242,8 +241,8 @@ client_can_cache:
if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock granted on inode %p", cFYI(1, "Exclusive Oplock granted on inode %p",
file->f_path.dentry->d_inode)); file->f_path.dentry->d_inode);
} else if ((*oplock & 0xF) == OPLOCK_READ) } else if ((*oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
@ -285,8 +284,8 @@ int cifs_open(struct inode *inode, struct file *file)
return rc; return rc;
} }
cFYI(1, ("inode = 0x%p file flags are 0x%x for %s", cFYI(1, "inode = 0x%p file flags are 0x%x for %s",
inode, file->f_flags, full_path)); inode, file->f_flags, full_path);
if (oplockEnabled) if (oplockEnabled)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
@ -298,27 +297,29 @@ int cifs_open(struct inode *inode, struct file *file)
(CIFS_UNIX_POSIX_PATH_OPS_CAP & (CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
int oflags = (int) cifs_posix_convert_flags(file->f_flags); int oflags = (int) cifs_posix_convert_flags(file->f_flags);
oflags |= SMB_O_CREAT;
/* can not refresh inode info since size could be stale */ /* can not refresh inode info since size could be stale */
rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, rc = cifs_posix_open(full_path, &inode, file->f_path.mnt,
cifs_sb->mnt_file_mode /* ignored */, inode->i_sb,
oflags, &oplock, &netfid, xid); cifs_sb->mnt_file_mode /* ignored */,
oflags, &oplock, &netfid, xid);
if (rc == 0) { if (rc == 0) {
cFYI(1, ("posix open succeeded")); cFYI(1, "posix open succeeded");
/* no need for special case handling of setting mode /* no need for special case handling of setting mode
on read only files needed here */ on read only files needed here */
pCifsFile = cifs_fill_filedata(file); pCifsFile = cifs_fill_filedata(file);
cifs_posix_open_inode_helper(inode, file, pCifsInode, cifs_posix_open_inode_helper(inode, file, pCifsInode,
pCifsFile, oplock, netfid); oplock, netfid);
goto out; goto out;
} else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
if (tcon->ses->serverNOS) if (tcon->ses->serverNOS)
cERROR(1, ("server %s of type %s returned" cERROR(1, "server %s of type %s returned"
" unexpected error on SMB posix open" " unexpected error on SMB posix open"
", disabling posix open support." ", disabling posix open support."
" Check if server update available.", " Check if server update available.",
tcon->ses->serverName, tcon->ses->serverName,
tcon->ses->serverNOS)); tcon->ses->serverNOS);
tcon->broken_posix_open = true; tcon->broken_posix_open = true;
} else if ((rc != -EIO) && (rc != -EREMOTE) && } else if ((rc != -EIO) && (rc != -EREMOTE) &&
(rc != -EOPNOTSUPP)) /* path not found or net err */ (rc != -EOPNOTSUPP)) /* path not found or net err */
@ -386,7 +387,7 @@ int cifs_open(struct inode *inode, struct file *file)
& CIFS_MOUNT_MAP_SPECIAL_CHR); & CIFS_MOUNT_MAP_SPECIAL_CHR);
} }
if (rc) { if (rc) {
cFYI(1, ("cifs_open returned 0x%x", rc)); cFYI(1, "cifs_open returned 0x%x", rc);
goto out; goto out;
} }
@ -469,7 +470,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
} }
if (file->f_path.dentry == NULL) { if (file->f_path.dentry == NULL) {
cERROR(1, ("no valid name if dentry freed")); cERROR(1, "no valid name if dentry freed");
dump_stack(); dump_stack();
rc = -EBADF; rc = -EBADF;
goto reopen_error_exit; goto reopen_error_exit;
@ -477,7 +478,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
inode = file->f_path.dentry->d_inode; inode = file->f_path.dentry->d_inode;
if (inode == NULL) { if (inode == NULL) {
cERROR(1, ("inode not valid")); cERROR(1, "inode not valid");
dump_stack(); dump_stack();
rc = -EBADF; rc = -EBADF;
goto reopen_error_exit; goto reopen_error_exit;
@ -499,8 +500,8 @@ reopen_error_exit:
return rc; return rc;
} }
cFYI(1, ("inode = 0x%p file flags 0x%x for %s", cFYI(1, "inode = 0x%p file flags 0x%x for %s",
inode, file->f_flags, full_path)); inode, file->f_flags, full_path);
if (oplockEnabled) if (oplockEnabled)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
@ -513,10 +514,11 @@ reopen_error_exit:
int oflags = (int) cifs_posix_convert_flags(file->f_flags); int oflags = (int) cifs_posix_convert_flags(file->f_flags);
/* can not refresh inode info since size could be stale */ /* can not refresh inode info since size could be stale */
rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, rc = cifs_posix_open(full_path, NULL, file->f_path.mnt,
cifs_sb->mnt_file_mode /* ignored */, inode->i_sb,
oflags, &oplock, &netfid, xid); cifs_sb->mnt_file_mode /* ignored */,
oflags, &oplock, &netfid, xid);
if (rc == 0) { if (rc == 0) {
cFYI(1, ("posix reopen succeeded")); cFYI(1, "posix reopen succeeded");
goto reopen_success; goto reopen_success;
} }
/* fallthrough to retry open the old way on errors, especially /* fallthrough to retry open the old way on errors, especially
@ -537,8 +539,8 @@ reopen_error_exit:
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
mutex_unlock(&pCifsFile->fh_mutex); mutex_unlock(&pCifsFile->fh_mutex);
cFYI(1, ("cifs_open returned 0x%x", rc)); cFYI(1, "cifs_open returned 0x%x", rc);
cFYI(1, ("oplock: %d", oplock)); cFYI(1, "oplock: %d", oplock);
} else { } else {
reopen_success: reopen_success:
pCifsFile->netfid = netfid; pCifsFile->netfid = netfid;
@ -570,8 +572,8 @@ reopen_success:
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock granted on inode %p", cFYI(1, "Exclusive Oplock granted on inode %p",
file->f_path.dentry->d_inode)); file->f_path.dentry->d_inode);
} else if ((oplock & 0xF) == OPLOCK_READ) { } else if ((oplock & 0xF) == OPLOCK_READ) {
pCifsInode->clientCanCacheRead = true; pCifsInode->clientCanCacheRead = true;
pCifsInode->clientCanCacheAll = false; pCifsInode->clientCanCacheAll = false;
@ -619,8 +621,7 @@ int cifs_close(struct inode *inode, struct file *file)
the struct would be in each open file, the struct would be in each open file,
but this should give enough time to but this should give enough time to
clear the socket */ clear the socket */
cFYI(DBG2, cFYI(DBG2, "close delay, write pending");
("close delay, write pending"));
msleep(timeout); msleep(timeout);
timeout *= 4; timeout *= 4;
} }
@ -653,7 +654,7 @@ int cifs_close(struct inode *inode, struct file *file)
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
if (list_empty(&(CIFS_I(inode)->openFileList))) { if (list_empty(&(CIFS_I(inode)->openFileList))) {
cFYI(1, ("closing last open instance for inode %p", inode)); cFYI(1, "closing last open instance for inode %p", inode);
/* if the file is not open we do not know if we can cache info /* if the file is not open we do not know if we can cache info
on this inode, much less write behind and read ahead */ on this inode, much less write behind and read ahead */
CIFS_I(inode)->clientCanCacheRead = false; CIFS_I(inode)->clientCanCacheRead = false;
@ -674,7 +675,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
(struct cifsFileInfo *)file->private_data; (struct cifsFileInfo *)file->private_data;
char *ptmp; char *ptmp;
cFYI(1, ("Closedir inode = 0x%p", inode)); cFYI(1, "Closedir inode = 0x%p", inode);
xid = GetXid(); xid = GetXid();
@ -685,22 +686,22 @@ int cifs_closedir(struct inode *inode, struct file *file)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
cFYI(1, ("Freeing private data in close dir")); cFYI(1, "Freeing private data in close dir");
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
if (!pCFileStruct->srch_inf.endOfSearch && if (!pCFileStruct->srch_inf.endOfSearch &&
!pCFileStruct->invalidHandle) { !pCFileStruct->invalidHandle) {
pCFileStruct->invalidHandle = true; pCFileStruct->invalidHandle = true;
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid);
cFYI(1, ("Closing uncompleted readdir with rc %d", cFYI(1, "Closing uncompleted readdir with rc %d",
rc)); rc);
/* not much we can do if it fails anyway, ignore rc */ /* not much we can do if it fails anyway, ignore rc */
rc = 0; rc = 0;
} else } else
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; ptmp = pCFileStruct->srch_inf.ntwrk_buf_start;
if (ptmp) { if (ptmp) {
cFYI(1, ("closedir free smb buf in srch struct")); cFYI(1, "closedir free smb buf in srch struct");
pCFileStruct->srch_inf.ntwrk_buf_start = NULL; pCFileStruct->srch_inf.ntwrk_buf_start = NULL;
if (pCFileStruct->srch_inf.smallBuf) if (pCFileStruct->srch_inf.smallBuf)
cifs_small_buf_release(ptmp); cifs_small_buf_release(ptmp);
@ -748,49 +749,49 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
rc = -EACCES; rc = -EACCES;
xid = GetXid(); xid = GetXid();
cFYI(1, ("Lock parm: 0x%x flockflags: " cFYI(1, "Lock parm: 0x%x flockflags: "
"0x%x flocktype: 0x%x start: %lld end: %lld", "0x%x flocktype: 0x%x start: %lld end: %lld",
cmd, pfLock->fl_flags, pfLock->fl_type, pfLock->fl_start, cmd, pfLock->fl_flags, pfLock->fl_type, pfLock->fl_start,
pfLock->fl_end)); pfLock->fl_end);
if (pfLock->fl_flags & FL_POSIX) if (pfLock->fl_flags & FL_POSIX)
cFYI(1, ("Posix")); cFYI(1, "Posix");
if (pfLock->fl_flags & FL_FLOCK) if (pfLock->fl_flags & FL_FLOCK)
cFYI(1, ("Flock")); cFYI(1, "Flock");
if (pfLock->fl_flags & FL_SLEEP) { if (pfLock->fl_flags & FL_SLEEP) {
cFYI(1, ("Blocking lock")); cFYI(1, "Blocking lock");
wait_flag = true; wait_flag = true;
} }
if (pfLock->fl_flags & FL_ACCESS) if (pfLock->fl_flags & FL_ACCESS)
cFYI(1, ("Process suspended by mandatory locking - " cFYI(1, "Process suspended by mandatory locking - "
"not implemented yet")); "not implemented yet");
if (pfLock->fl_flags & FL_LEASE) if (pfLock->fl_flags & FL_LEASE)
cFYI(1, ("Lease on file - not implemented yet")); cFYI(1, "Lease on file - not implemented yet");
if (pfLock->fl_flags & if (pfLock->fl_flags &
(~(FL_POSIX | FL_FLOCK | FL_SLEEP | FL_ACCESS | FL_LEASE))) (~(FL_POSIX | FL_FLOCK | FL_SLEEP | FL_ACCESS | FL_LEASE)))
cFYI(1, ("Unknown lock flags 0x%x", pfLock->fl_flags)); cFYI(1, "Unknown lock flags 0x%x", pfLock->fl_flags);
if (pfLock->fl_type == F_WRLCK) { if (pfLock->fl_type == F_WRLCK) {
cFYI(1, ("F_WRLCK ")); cFYI(1, "F_WRLCK ");
numLock = 1; numLock = 1;
} else if (pfLock->fl_type == F_UNLCK) { } else if (pfLock->fl_type == F_UNLCK) {
cFYI(1, ("F_UNLCK")); cFYI(1, "F_UNLCK");
numUnlock = 1; numUnlock = 1;
/* Check if unlock includes more than /* Check if unlock includes more than
one lock range */ one lock range */
} else if (pfLock->fl_type == F_RDLCK) { } else if (pfLock->fl_type == F_RDLCK) {
cFYI(1, ("F_RDLCK")); cFYI(1, "F_RDLCK");
lockType |= LOCKING_ANDX_SHARED_LOCK; lockType |= LOCKING_ANDX_SHARED_LOCK;
numLock = 1; numLock = 1;
} else if (pfLock->fl_type == F_EXLCK) { } else if (pfLock->fl_type == F_EXLCK) {
cFYI(1, ("F_EXLCK")); cFYI(1, "F_EXLCK");
numLock = 1; numLock = 1;
} else if (pfLock->fl_type == F_SHLCK) { } else if (pfLock->fl_type == F_SHLCK) {
cFYI(1, ("F_SHLCK")); cFYI(1, "F_SHLCK");
lockType |= LOCKING_ANDX_SHARED_LOCK; lockType |= LOCKING_ANDX_SHARED_LOCK;
numLock = 1; numLock = 1;
} else } else
cFYI(1, ("Unknown type of lock")); cFYI(1, "Unknown type of lock");
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
tcon = cifs_sb->tcon; tcon = cifs_sb->tcon;
@ -833,8 +834,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
0 /* wait flag */ ); 0 /* wait flag */ );
pfLock->fl_type = F_UNLCK; pfLock->fl_type = F_UNLCK;
if (rc != 0) if (rc != 0)
cERROR(1, ("Error unlocking previously locked " cERROR(1, "Error unlocking previously locked "
"range %d during test of lock", rc)); "range %d during test of lock", rc);
rc = 0; rc = 0;
} else { } else {
@ -856,9 +857,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
0 /* wait flag */); 0 /* wait flag */);
pfLock->fl_type = F_RDLCK; pfLock->fl_type = F_RDLCK;
if (rc != 0) if (rc != 0)
cERROR(1, ("Error unlocking " cERROR(1, "Error unlocking "
"previously locked range %d " "previously locked range %d "
"during test of lock", rc)); "during test of lock", rc);
rc = 0; rc = 0;
} else { } else {
pfLock->fl_type = F_WRLCK; pfLock->fl_type = F_WRLCK;
@ -923,9 +924,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
1, 0, li->type, false); 1, 0, li->type, false);
if (stored_rc) if (stored_rc)
rc = stored_rc; rc = stored_rc;
else {
list_del(&li->llist); list_del(&li->llist);
kfree(li); kfree(li);
}
} }
} }
mutex_unlock(&fid->lock_mutex); mutex_unlock(&fid->lock_mutex);
@ -988,9 +990,8 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
/* cFYI(1, /* cFYI(1, " write %d bytes to offset %lld of %s", write_size,
(" write %d bytes to offset %lld of %s", write_size, *poffset, file->f_path.dentry->d_name.name); */
*poffset, file->f_path.dentry->d_name.name)); */
if (file->private_data == NULL) if (file->private_data == NULL)
return -EBADF; return -EBADF;
@ -1091,8 +1092,8 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
cFYI(1, ("write %zd bytes to offset %lld of %s", write_size, cFYI(1, "write %zd bytes to offset %lld of %s", write_size,
*poffset, file->f_path.dentry->d_name.name)); *poffset, file->f_path.dentry->d_name.name);
if (file->private_data == NULL) if (file->private_data == NULL)
return -EBADF; return -EBADF;
@ -1233,7 +1234,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
it being zero) during stress testcases so we need to check for it */ it being zero) during stress testcases so we need to check for it */
if (cifs_inode == NULL) { if (cifs_inode == NULL) {
cERROR(1, ("Null inode passed to cifs_writeable_file")); cERROR(1, "Null inode passed to cifs_writeable_file");
dump_stack(); dump_stack();
return NULL; return NULL;
} }
@ -1277,7 +1278,7 @@ refind_writable:
again. Note that it would be bad again. Note that it would be bad
to hold up writepages here (rather than to hold up writepages here (rather than
in caller) with continuous retries */ in caller) with continuous retries */
cFYI(1, ("wp failed on reopen file")); cFYI(1, "wp failed on reopen file");
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
/* can not use this handle, no write /* can not use this handle, no write
pending on this one after all */ pending on this one after all */
@ -1353,7 +1354,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
else if (bytes_written < 0) else if (bytes_written < 0)
rc = bytes_written; rc = bytes_written;
} else { } else {
cFYI(1, ("No writeable filehandles for inode")); cFYI(1, "No writeable filehandles for inode");
rc = -EIO; rc = -EIO;
} }
@ -1525,7 +1526,7 @@ retry:
*/ */
open_file = find_writable_file(CIFS_I(mapping->host)); open_file = find_writable_file(CIFS_I(mapping->host));
if (!open_file) { if (!open_file) {
cERROR(1, ("No writable handles for inode")); cERROR(1, "No writable handles for inode");
rc = -EBADF; rc = -EBADF;
} else { } else {
long_op = cifs_write_timeout(cifsi, offset); long_op = cifs_write_timeout(cifsi, offset);
@ -1538,8 +1539,8 @@ retry:
cifs_update_eof(cifsi, offset, bytes_written); cifs_update_eof(cifsi, offset, bytes_written);
if (rc || bytes_written < bytes_to_write) { if (rc || bytes_written < bytes_to_write) {
cERROR(1, ("Write2 ret %d, wrote %d", cERROR(1, "Write2 ret %d, wrote %d",
rc, bytes_written)); rc, bytes_written);
/* BB what if continued retry is /* BB what if continued retry is
requested via mount flags? */ requested via mount flags? */
if (rc == -ENOSPC) if (rc == -ENOSPC)
@ -1600,7 +1601,7 @@ static int cifs_writepage(struct page *page, struct writeback_control *wbc)
/* BB add check for wbc flags */ /* BB add check for wbc flags */
page_cache_get(page); page_cache_get(page);
if (!PageUptodate(page)) if (!PageUptodate(page))
cFYI(1, ("ppw - page not up to date")); cFYI(1, "ppw - page not up to date");
/* /*
* Set the "writeback" flag, and clear "dirty" in the radix tree. * 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,
int rc; int rc;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
cFYI(1, ("write_end for page %p from pos %lld with %d bytes", cFYI(1, "write_end for page %p from pos %lld with %d bytes",
page, pos, copied)); page, pos, copied);
if (PageChecked(page)) { if (PageChecked(page)) {
if (copied == len) if (copied == len)
@ -1686,8 +1687,8 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
xid = GetXid(); xid = GetXid();
cFYI(1, ("Sync file - name: %s datasync: 0x%x", cFYI(1, "Sync file - name: %s datasync: 0x%x",
dentry->d_name.name, datasync)); dentry->d_name.name, datasync);
rc = filemap_write_and_wait(inode->i_mapping); rc = filemap_write_and_wait(inode->i_mapping);
if (rc == 0) { if (rc == 0) {
@ -1711,7 +1712,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
unsigned int rpages = 0; unsigned int rpages = 0;
int rc = 0; int rc = 0;
cFYI(1, ("sync page %p",page)); cFYI(1, "sync page %p", page);
mapping = page->mapping; mapping = page->mapping;
if (!mapping) if (!mapping)
return 0; return 0;
@ -1722,7 +1723,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
/* fill in rpages then /* fill in rpages then
result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */ result = cifs_pagein_inode(inode, index, rpages); */ /* BB finish */
/* cFYI(1, ("rpages is %d for sync page of Index %ld", rpages, index)); /* cFYI(1, "rpages is %d for sync page of Index %ld", rpages, index);
#if 0 #if 0
if (rc < 0) if (rc < 0)
@ -1756,7 +1757,7 @@ int cifs_flush(struct file *file, fl_owner_t id)
CIFS_I(inode)->write_behind_rc = 0; CIFS_I(inode)->write_behind_rc = 0;
} }
cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc)); cFYI(1, "Flush inode %p file %p rc %d", inode, file, rc);
return rc; return rc;
} }
@ -1788,7 +1789,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
open_file = (struct cifsFileInfo *)file->private_data; open_file = (struct cifsFileInfo *)file->private_data;
if ((file->f_flags & O_ACCMODE) == O_WRONLY) if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cFYI(1, ("attempting read on write only file instance")); cFYI(1, "attempting read on write only file instance");
for (total_read = 0, current_offset = read_data; for (total_read = 0, current_offset = read_data;
read_size > total_read; read_size > total_read;
@ -1869,7 +1870,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
open_file = (struct cifsFileInfo *)file->private_data; open_file = (struct cifsFileInfo *)file->private_data;
if ((file->f_flags & O_ACCMODE) == O_WRONLY) if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cFYI(1, ("attempting read on write only file instance")); cFYI(1, "attempting read on write only file instance");
for (total_read = 0, current_offset = read_data; for (total_read = 0, current_offset = read_data;
read_size > total_read; read_size > total_read;
@ -1920,7 +1921,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
xid = GetXid(); xid = GetXid();
rc = cifs_revalidate_file(file); rc = cifs_revalidate_file(file);
if (rc) { if (rc) {
cFYI(1, ("Validation prior to mmap failed, error=%d", rc)); cFYI(1, "Validation prior to mmap failed, error=%d", rc);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
@ -1931,8 +1932,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
static void cifs_copy_cache_pages(struct address_space *mapping, static void cifs_copy_cache_pages(struct address_space *mapping,
struct list_head *pages, int bytes_read, char *data, struct list_head *pages, int bytes_read, char *data)
struct pagevec *plru_pvec)
{ {
struct page *page; struct page *page;
char *target; char *target;
@ -1944,10 +1944,10 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
page = list_entry(pages->prev, struct page, lru); page = list_entry(pages->prev, struct page, lru);
list_del(&page->lru); list_del(&page->lru);
if (add_to_page_cache(page, mapping, page->index, if (add_to_page_cache_lru(page, mapping, page->index,
GFP_KERNEL)) { GFP_KERNEL)) {
page_cache_release(page); page_cache_release(page);
cFYI(1, ("Add page cache failed")); cFYI(1, "Add page cache failed");
data += PAGE_CACHE_SIZE; data += PAGE_CACHE_SIZE;
bytes_read -= PAGE_CACHE_SIZE; bytes_read -= PAGE_CACHE_SIZE;
continue; continue;
@ -1970,8 +1970,6 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
flush_dcache_page(page); flush_dcache_page(page);
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); unlock_page(page);
if (!pagevec_add(plru_pvec, page))
__pagevec_lru_add_file(plru_pvec);
data += PAGE_CACHE_SIZE; data += PAGE_CACHE_SIZE;
} }
return; return;
@ -1990,7 +1988,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
unsigned int read_size, i; unsigned int read_size, i;
char *smb_read_data = NULL; char *smb_read_data = NULL;
struct smb_com_read_rsp *pSMBr; struct smb_com_read_rsp *pSMBr;
struct pagevec lru_pvec;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
int buf_type = CIFS_NO_BUFFER; int buf_type = CIFS_NO_BUFFER;
@ -2004,8 +2001,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
pagevec_init(&lru_pvec, 0); cFYI(DBG2, "rpages: num pages %d", num_pages);
cFYI(DBG2, ("rpages: num pages %d", num_pages));
for (i = 0; i < num_pages; ) { for (i = 0; i < num_pages; ) {
unsigned contig_pages; unsigned contig_pages;
struct page *tmp_page; struct page *tmp_page;
@ -2038,8 +2034,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
/* Read size needs to be in multiples of one page */ /* Read size needs to be in multiples of one page */
read_size = min_t(const unsigned int, read_size, read_size = min_t(const unsigned int, read_size,
cifs_sb->rsize & PAGE_CACHE_MASK); cifs_sb->rsize & PAGE_CACHE_MASK);
cFYI(DBG2, ("rpages: read size 0x%x contiguous pages %d", cFYI(DBG2, "rpages: read size 0x%x contiguous pages %d",
read_size, contig_pages)); read_size, contig_pages);
rc = -EAGAIN; rc = -EAGAIN;
while (rc == -EAGAIN) { while (rc == -EAGAIN) {
if ((open_file->invalidHandle) && if ((open_file->invalidHandle) &&
@ -2066,14 +2062,14 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
} }
} }
if ((rc < 0) || (smb_read_data == NULL)) { if ((rc < 0) || (smb_read_data == NULL)) {
cFYI(1, ("Read error in readpages: %d", rc)); cFYI(1, "Read error in readpages: %d", rc);
break; break;
} else if (bytes_read > 0) { } else if (bytes_read > 0) {
task_io_account_read(bytes_read); task_io_account_read(bytes_read);
pSMBr = (struct smb_com_read_rsp *)smb_read_data; pSMBr = (struct smb_com_read_rsp *)smb_read_data;
cifs_copy_cache_pages(mapping, page_list, bytes_read, cifs_copy_cache_pages(mapping, page_list, bytes_read,
smb_read_data + 4 /* RFC1001 hdr */ + smb_read_data + 4 /* RFC1001 hdr */ +
le16_to_cpu(pSMBr->DataOffset), &lru_pvec); le16_to_cpu(pSMBr->DataOffset));
i += bytes_read >> PAGE_CACHE_SHIFT; i += bytes_read >> PAGE_CACHE_SHIFT;
cifs_stats_bytes_read(pTcon, bytes_read); cifs_stats_bytes_read(pTcon, bytes_read);
@ -2089,9 +2085,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
/* break; */ /* break; */
} }
} else { } else {
cFYI(1, ("No bytes read (%d) at offset %lld . " cFYI(1, "No bytes read (%d) at offset %lld . "
"Cleaning remaining pages from readahead list", "Cleaning remaining pages from readahead list",
bytes_read, offset)); bytes_read, offset);
/* BB turn off caching and do new lookup on /* BB turn off caching and do new lookup on
file size at server? */ file size at server? */
break; break;
@ -2106,8 +2102,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
bytes_read = 0; bytes_read = 0;
} }
pagevec_lru_add_file(&lru_pvec);
/* need to free smb_read_data buf before exit */ /* need to free smb_read_data buf before exit */
if (smb_read_data) { if (smb_read_data) {
if (buf_type == CIFS_SMALL_BUFFER) if (buf_type == CIFS_SMALL_BUFFER)
@ -2136,7 +2130,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
if (rc < 0) if (rc < 0)
goto io_error; goto io_error;
else else
cFYI(1, ("Bytes read %d", rc)); cFYI(1, "Bytes read %d", rc);
file->f_path.dentry->d_inode->i_atime = file->f_path.dentry->d_inode->i_atime =
current_fs_time(file->f_path.dentry->d_inode->i_sb); 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)
return rc; return rc;
} }
cFYI(1, ("readpage %p at offset %d 0x%x\n", cFYI(1, "readpage %p at offset %d 0x%x\n",
page, (int)offset, (int)offset)); page, (int)offset, (int)offset);
rc = cifs_readpage_worker(file, page, &offset); rc = cifs_readpage_worker(file, page, &offset);
@ -2239,7 +2233,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
struct page *page; struct page *page;
int rc = 0; int rc = 0;
cFYI(1, ("write_begin from %lld len %d", (long long)pos, len)); cFYI(1, "write_begin from %lld len %d", (long long)pos, len);
page = grab_cache_page_write_begin(mapping, index, flags); page = grab_cache_page_write_begin(mapping, index, flags);
if (!page) { if (!page) {
@ -2311,12 +2305,10 @@ cifs_oplock_break(struct slow_work *work)
int rc, waitrc = 0; int rc, waitrc = 0;
if (inode && S_ISREG(inode->i_mode)) { if (inode && S_ISREG(inode->i_mode)) {
#ifdef CONFIG_CIFS_EXPERIMENTAL if (cinode->clientCanCacheRead)
if (cinode->clientCanCacheAll == 0)
break_lease(inode, O_RDONLY); break_lease(inode, O_RDONLY);
else if (cinode->clientCanCacheRead == 0) else
break_lease(inode, O_WRONLY); break_lease(inode, O_WRONLY);
#endif
rc = filemap_fdatawrite(inode->i_mapping); rc = filemap_fdatawrite(inode->i_mapping);
if (cinode->clientCanCacheRead == 0) { if (cinode->clientCanCacheRead == 0) {
waitrc = filemap_fdatawait(inode->i_mapping); waitrc = filemap_fdatawait(inode->i_mapping);
@ -2326,7 +2318,7 @@ cifs_oplock_break(struct slow_work *work)
rc = waitrc; rc = waitrc;
if (rc) if (rc)
cinode->write_behind_rc = rc; cinode->write_behind_rc = rc;
cFYI(1, ("Oplock flush inode %p rc %d", inode, rc)); cFYI(1, "Oplock flush inode %p rc %d", inode, rc);
} }
/* /*
@ -2338,7 +2330,7 @@ cifs_oplock_break(struct slow_work *work)
if (!cfile->closePend && !cfile->oplock_break_cancelled) { if (!cfile->closePend && !cfile->oplock_break_cancelled) {
rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0, rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0,
LOCKING_ANDX_OPLOCK_RELEASE, false); LOCKING_ANDX_OPLOCK_RELEASE, false);
cFYI(1, ("Oplock release rc = %d", rc)); cFYI(1, "Oplock release rc = %d", rc);
} }
} }

View file

@ -1,7 +1,7 @@
/* /*
* fs/cifs/inode.c * fs/cifs/inode.c
* *
* Copyright (C) International Business Machines Corp., 2002,2008 * Copyright (C) International Business Machines Corp., 2002,2010
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
@ -86,30 +86,30 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
{ {
struct cifsInodeInfo *cifs_i = CIFS_I(inode); struct cifsInodeInfo *cifs_i = CIFS_I(inode);
cFYI(1, ("%s: revalidating inode %llu", __func__, cifs_i->uniqueid)); cFYI(1, "%s: revalidating inode %llu", __func__, cifs_i->uniqueid);
if (inode->i_state & I_NEW) { if (inode->i_state & I_NEW) {
cFYI(1, ("%s: inode %llu is new", __func__, cifs_i->uniqueid)); cFYI(1, "%s: inode %llu is new", __func__, cifs_i->uniqueid);
return; return;
} }
/* don't bother with revalidation if we have an oplock */ /* don't bother with revalidation if we have an oplock */
if (cifs_i->clientCanCacheRead) { if (cifs_i->clientCanCacheRead) {
cFYI(1, ("%s: inode %llu is oplocked", __func__, cFYI(1, "%s: inode %llu is oplocked", __func__,
cifs_i->uniqueid)); cifs_i->uniqueid);
return; return;
} }
/* revalidate if mtime or size have changed */ /* revalidate if mtime or size have changed */
if (timespec_equal(&inode->i_mtime, &fattr->cf_mtime) && if (timespec_equal(&inode->i_mtime, &fattr->cf_mtime) &&
cifs_i->server_eof == fattr->cf_eof) { cifs_i->server_eof == fattr->cf_eof) {
cFYI(1, ("%s: inode %llu is unchanged", __func__, cFYI(1, "%s: inode %llu is unchanged", __func__,
cifs_i->uniqueid)); cifs_i->uniqueid);
return; return;
} }
cFYI(1, ("%s: invalidating inode %llu mapping", __func__, cFYI(1, "%s: invalidating inode %llu mapping", __func__,
cifs_i->uniqueid)); cifs_i->uniqueid);
cifs_i->invalid_mapping = true; cifs_i->invalid_mapping = true;
} }
@ -137,15 +137,14 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
inode->i_mode = fattr->cf_mode; inode->i_mode = fattr->cf_mode;
cifs_i->cifsAttrs = fattr->cf_cifsattrs; cifs_i->cifsAttrs = fattr->cf_cifsattrs;
cifs_i->uniqueid = fattr->cf_uniqueid;
if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL) if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
cifs_i->time = 0; cifs_i->time = 0;
else else
cifs_i->time = jiffies; cifs_i->time = jiffies;
cFYI(1, ("inode 0x%p old_time=%ld new_time=%ld", inode, cFYI(1, "inode 0x%p old_time=%ld new_time=%ld", inode,
oldtime, cifs_i->time)); oldtime, cifs_i->time);
cifs_i->delete_pending = fattr->cf_flags & CIFS_FATTR_DELETE_PENDING; cifs_i->delete_pending = fattr->cf_flags & CIFS_FATTR_DELETE_PENDING;
@ -170,6 +169,17 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
cifs_set_ops(inode, fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL); cifs_set_ops(inode, fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL);
} }
void
cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
return;
fattr->cf_uniqueid = iunique(sb, ROOT_I);
}
/* Fill a cifs_fattr struct with info from FILE_UNIX_BASIC_INFO. */ /* Fill a cifs_fattr struct with info from FILE_UNIX_BASIC_INFO. */
void void
cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,
@ -227,7 +237,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,
/* safest to call it a file if we do not know */ /* safest to call it a file if we do not know */
fattr->cf_mode |= S_IFREG; fattr->cf_mode |= S_IFREG;
fattr->cf_dtype = DT_REG; fattr->cf_dtype = DT_REG;
cFYI(1, ("unknown type %d", le32_to_cpu(info->Type))); cFYI(1, "unknown type %d", le32_to_cpu(info->Type));
break; break;
} }
@ -256,7 +266,7 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
cFYI(1, ("creating fake fattr for DFS referral")); cFYI(1, "creating fake fattr for DFS referral");
memset(fattr, 0, sizeof(*fattr)); memset(fattr, 0, sizeof(*fattr));
fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU; fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU;
@ -305,7 +315,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
tcon = cifs_sb->tcon; tcon = cifs_sb->tcon;
cFYI(1, ("Getting info on %s", full_path)); cFYI(1, "Getting info on %s", full_path);
/* could have done a find first instead but this returns more info */ /* could have done a find first instead but this returns more info */
rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data, rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data,
@ -323,6 +333,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
if (*pinode == NULL) { if (*pinode == NULL) {
/* get new inode */ /* get new inode */
cifs_fill_uniqueid(sb, &fattr);
*pinode = cifs_iget(sb, &fattr); *pinode = cifs_iget(sb, &fattr);
if (!*pinode) if (!*pinode)
rc = -ENOMEM; rc = -ENOMEM;
@ -373,7 +384,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
&bytes_read, &pbuf, &buf_type); &bytes_read, &pbuf, &buf_type);
if ((rc == 0) && (bytes_read >= 8)) { if ((rc == 0) && (bytes_read >= 8)) {
if (memcmp("IntxBLK", pbuf, 8) == 0) { if (memcmp("IntxBLK", pbuf, 8) == 0) {
cFYI(1, ("Block device")); cFYI(1, "Block device");
fattr->cf_mode |= S_IFBLK; fattr->cf_mode |= S_IFBLK;
fattr->cf_dtype = DT_BLK; fattr->cf_dtype = DT_BLK;
if (bytes_read == 24) { if (bytes_read == 24) {
@ -385,7 +396,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
fattr->cf_rdev = MKDEV(mjr, mnr); fattr->cf_rdev = MKDEV(mjr, mnr);
} }
} else if (memcmp("IntxCHR", pbuf, 8) == 0) { } else if (memcmp("IntxCHR", pbuf, 8) == 0) {
cFYI(1, ("Char device")); cFYI(1, "Char device");
fattr->cf_mode |= S_IFCHR; fattr->cf_mode |= S_IFCHR;
fattr->cf_dtype = DT_CHR; fattr->cf_dtype = DT_CHR;
if (bytes_read == 24) { if (bytes_read == 24) {
@ -397,7 +408,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
fattr->cf_rdev = MKDEV(mjr, mnr); fattr->cf_rdev = MKDEV(mjr, mnr);
} }
} else if (memcmp("IntxLNK", pbuf, 7) == 0) { } else if (memcmp("IntxLNK", pbuf, 7) == 0) {
cFYI(1, ("Symlink")); cFYI(1, "Symlink");
fattr->cf_mode |= S_IFLNK; fattr->cf_mode |= S_IFLNK;
fattr->cf_dtype = DT_LNK; fattr->cf_dtype = DT_LNK;
} else { } else {
@ -439,10 +450,10 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
else if (rc > 3) { else if (rc > 3) {
mode = le32_to_cpu(*((__le32 *)ea_value)); mode = le32_to_cpu(*((__le32 *)ea_value));
fattr->cf_mode &= ~SFBITS_MASK; fattr->cf_mode &= ~SFBITS_MASK;
cFYI(1, ("special bits 0%o org mode 0%o", mode, cFYI(1, "special bits 0%o org mode 0%o", mode,
fattr->cf_mode)); fattr->cf_mode);
fattr->cf_mode = (mode & SFBITS_MASK) | fattr->cf_mode; fattr->cf_mode = (mode & SFBITS_MASK) | fattr->cf_mode;
cFYI(1, ("special mode bits 0%o", mode)); cFYI(1, "special mode bits 0%o", mode);
} }
return 0; return 0;
@ -548,11 +559,11 @@ int cifs_get_inode_info(struct inode **pinode,
struct cifs_fattr fattr; struct cifs_fattr fattr;
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
cFYI(1, ("Getting info on %s", full_path)); cFYI(1, "Getting info on %s", full_path);
if ((pfindData == NULL) && (*pinode != NULL)) { if ((pfindData == NULL) && (*pinode != NULL)) {
if (CIFS_I(*pinode)->clientCanCacheRead) { if (CIFS_I(*pinode)->clientCanCacheRead) {
cFYI(1, ("No need to revalidate cached inode sizes")); cFYI(1, "No need to revalidate cached inode sizes");
return rc; return rc;
} }
} }
@ -618,7 +629,7 @@ int cifs_get_inode_info(struct inode **pinode,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc1 || !fattr.cf_uniqueid) { if (rc1 || !fattr.cf_uniqueid) {
cFYI(1, ("GetSrvInodeNum rc %d", rc1)); cFYI(1, "GetSrvInodeNum rc %d", rc1);
fattr.cf_uniqueid = iunique(sb, ROOT_I); fattr.cf_uniqueid = iunique(sb, ROOT_I);
cifs_autodisable_serverino(cifs_sb); cifs_autodisable_serverino(cifs_sb);
} }
@ -634,13 +645,13 @@ int cifs_get_inode_info(struct inode **pinode,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
tmprc = cifs_sfu_type(&fattr, full_path, cifs_sb, xid); tmprc = cifs_sfu_type(&fattr, full_path, cifs_sb, xid);
if (tmprc) if (tmprc)
cFYI(1, ("cifs_sfu_type failed: %d", tmprc)); cFYI(1, "cifs_sfu_type failed: %d", tmprc);
} }
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
/* fill in 0777 bits from ACL */ /* fill in 0777 bits from ACL */
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
cFYI(1, ("Getting mode bits from ACL")); cFYI(1, "Getting mode bits from ACL");
cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, pfid); cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, pfid);
} }
#endif #endif
@ -745,7 +756,7 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *fattr)
struct inode *inode; struct inode *inode;
retry_iget5_locked: retry_iget5_locked:
cFYI(1, ("looking for uniqueid=%llu", fattr->cf_uniqueid)); cFYI(1, "looking for uniqueid=%llu", fattr->cf_uniqueid);
/* hash down to 32-bits on 32-bit arch */ /* hash down to 32-bits on 32-bit arch */
hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid); hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid);
@ -797,7 +808,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (rc && cifs_sb->tcon->ipc) { if (rc && cifs_sb->tcon->ipc) {
cFYI(1, ("ipc connection - fake read inode")); cFYI(1, "ipc connection - fake read inode");
inode->i_mode |= S_IFDIR; inode->i_mode |= S_IFDIR;
inode->i_nlink = 2; inode->i_nlink = 2;
inode->i_op = &cifs_ipc_inode_ops; inode->i_op = &cifs_ipc_inode_ops;
@ -859,7 +870,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
* server times. * server times.
*/ */
if (set_time && (attrs->ia_valid & ATTR_CTIME)) { if (set_time && (attrs->ia_valid & ATTR_CTIME)) {
cFYI(1, ("CIFS - CTIME changed")); cFYI(1, "CIFS - CTIME changed");
info_buf.ChangeTime = info_buf.ChangeTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_ctime)); cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_ctime));
} else } else
@ -894,8 +905,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
goto out; goto out;
} }
cFYI(1, ("calling SetFileInfo since SetPathInfo for " cFYI(1, "calling SetFileInfo since SetPathInfo for "
"times not supported by this server")); "times not supported by this server");
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
SYNCHRONIZE | FILE_WRITE_ATTRIBUTES, SYNCHRONIZE | FILE_WRITE_ATTRIBUTES,
CREATE_NOT_DIR, &netfid, &oplock, CREATE_NOT_DIR, &netfid, &oplock,
@ -1053,7 +1064,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
struct iattr *attrs = NULL; struct iattr *attrs = NULL;
__u32 dosattr = 0, origattr = 0; __u32 dosattr = 0, origattr = 0;
cFYI(1, ("cifs_unlink, dir=0x%p, dentry=0x%p", dir, dentry)); cFYI(1, "cifs_unlink, dir=0x%p, dentry=0x%p", dir, dentry);
xid = GetXid(); xid = GetXid();
@ -1072,7 +1083,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
rc = CIFSPOSIXDelFile(xid, tcon, full_path, rc = CIFSPOSIXDelFile(xid, tcon, full_path,
SMB_POSIX_UNLINK_FILE_TARGET, cifs_sb->local_nls, SMB_POSIX_UNLINK_FILE_TARGET, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("posix del rc %d", rc)); cFYI(1, "posix del rc %d", rc);
if ((rc == 0) || (rc == -ENOENT)) if ((rc == 0) || (rc == -ENOENT))
goto psx_del_no_retry; goto psx_del_no_retry;
} }
@ -1146,7 +1157,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
struct inode *newinode = NULL; struct inode *newinode = NULL;
struct cifs_fattr fattr; struct cifs_fattr fattr;
cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode)); cFYI(1, "In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode);
xid = GetXid(); xid = GetXid();
@ -1181,7 +1192,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
kfree(pInfo); kfree(pInfo);
goto mkdir_retry_old; goto mkdir_retry_old;
} else if (rc) { } else if (rc) {
cFYI(1, ("posix mkdir returned 0x%x", rc)); cFYI(1, "posix mkdir returned 0x%x", rc);
d_drop(direntry); d_drop(direntry);
} else { } else {
if (pInfo->Type == cpu_to_le32(-1)) { if (pInfo->Type == cpu_to_le32(-1)) {
@ -1198,6 +1209,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
direntry->d_op = &cifs_dentry_ops; direntry->d_op = &cifs_dentry_ops;
cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb);
cifs_fill_uniqueid(inode->i_sb, &fattr);
newinode = cifs_iget(inode->i_sb, &fattr); newinode = cifs_iget(inode->i_sb, &fattr);
if (!newinode) { if (!newinode) {
kfree(pInfo); kfree(pInfo);
@ -1207,12 +1219,12 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
d_instantiate(direntry, newinode); d_instantiate(direntry, newinode);
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
cFYI(1, ("instantiated dentry %p %s to inode %p", cFYI(1, "instantiated dentry %p %s to inode %p",
direntry, direntry->d_name.name, newinode)); direntry, direntry->d_name.name, newinode);
if (newinode->i_nlink != 2) if (newinode->i_nlink != 2)
cFYI(1, ("unexpected number of links %d", cFYI(1, "unexpected number of links %d",
newinode->i_nlink)); newinode->i_nlink);
#endif #endif
} }
kfree(pInfo); kfree(pInfo);
@ -1223,7 +1235,7 @@ mkdir_retry_old:
rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls, rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
cFYI(1, ("cifs_mkdir returned 0x%x", rc)); cFYI(1, "cifs_mkdir returned 0x%x", rc);
d_drop(direntry); d_drop(direntry);
} else { } else {
mkdir_get_info: mkdir_get_info:
@ -1326,7 +1338,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
char *full_path = NULL; char *full_path = NULL;
struct cifsInodeInfo *cifsInode; struct cifsInodeInfo *cifsInode;
cFYI(1, ("cifs_rmdir, inode = 0x%p", inode)); cFYI(1, "cifs_rmdir, inode = 0x%p", inode);
xid = GetXid(); xid = GetXid();
@ -1528,6 +1540,11 @@ cifs_inode_needs_reval(struct inode *inode)
if (time_after_eq(jiffies, cifs_i->time + HZ)) if (time_after_eq(jiffies, cifs_i->time + HZ))
return true; return true;
/* hardlinked files w/ noserverino get "special" treatment */
if (!(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) &&
S_ISREG(inode->i_mode) && inode->i_nlink != 1)
return true;
return false; return false;
} }
@ -1594,9 +1611,9 @@ int cifs_revalidate_dentry(struct dentry *dentry)
goto check_inval; goto check_inval;
} }
cFYI(1, ("Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld " cFYI(1, "Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld "
"jiffies %ld", full_path, inode, inode->i_count.counter, "jiffies %ld", full_path, inode, inode->i_count.counter,
dentry, dentry->d_time, jiffies)); dentry, dentry->d_time, jiffies);
if (CIFS_SB(sb)->tcon->unix_ext) if (CIFS_SB(sb)->tcon->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
@ -1690,12 +1707,12 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid, rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid,
npid, false); npid, false);
cifsFileInfo_put(open_file); cifsFileInfo_put(open_file);
cFYI(1, ("SetFSize for attrs rc = %d", rc)); cFYI(1, "SetFSize for attrs rc = %d", rc);
if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
unsigned int bytes_written; unsigned int bytes_written;
rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size, rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size,
&bytes_written, NULL, NULL, 1); &bytes_written, NULL, NULL, 1);
cFYI(1, ("Wrt seteof rc %d", rc)); cFYI(1, "Wrt seteof rc %d", rc);
} }
} else } else
rc = -EINVAL; rc = -EINVAL;
@ -1709,7 +1726,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
false, cifs_sb->local_nls, false, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); cFYI(1, "SetEOF by path (setattrs) rc = %d", rc);
if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
__u16 netfid; __u16 netfid;
int oplock = 0; int oplock = 0;
@ -1726,7 +1743,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
attrs->ia_size, attrs->ia_size,
&bytes_written, NULL, &bytes_written, NULL,
NULL, 1); NULL, 1);
cFYI(1, ("wrt seteof rc %d", rc)); cFYI(1, "wrt seteof rc %d", rc);
CIFSSMBClose(xid, pTcon, netfid); CIFSSMBClose(xid, pTcon, netfid);
} }
} }
@ -1754,8 +1771,8 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
struct cifs_unix_set_info_args *args = NULL; struct cifs_unix_set_info_args *args = NULL;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
cFYI(1, ("setattr_unix on file %s attrs->ia_valid=0x%x", cFYI(1, "setattr_unix on file %s attrs->ia_valid=0x%x",
direntry->d_name.name, attrs->ia_valid)); direntry->d_name.name, attrs->ia_valid);
xid = GetXid(); xid = GetXid();
@ -1885,8 +1902,8 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
xid = GetXid(); xid = GetXid();
cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", cFYI(1, "setattr on file %s attrs->iavalid 0x%x",
direntry->d_name.name, attrs->ia_valid)); direntry->d_name.name, attrs->ia_valid);
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
/* check if we have permission to change attrs */ /* check if we have permission to change attrs */
@ -1943,7 +1960,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
attrs->ia_valid &= ~ATTR_MODE; attrs->ia_valid &= ~ATTR_MODE;
if (attrs->ia_valid & ATTR_MODE) { if (attrs->ia_valid & ATTR_MODE) {
cFYI(1, ("Mode changed to 0%o", attrs->ia_mode)); cFYI(1, "Mode changed to 0%o", attrs->ia_mode);
mode = attrs->ia_mode; mode = attrs->ia_mode;
} }
@ -2029,7 +2046,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
#if 0 #if 0
void cifs_delete_inode(struct inode *inode) void cifs_delete_inode(struct inode *inode)
{ {
cFYI(1, ("In cifs_delete_inode, inode = 0x%p", inode)); cFYI(1, "In cifs_delete_inode, inode = 0x%p", inode);
/* may have to add back in if and when safe distributed caching of /* may have to add back in if and when safe distributed caching of
directories added e.g. via FindNotify */ directories added e.g. via FindNotify */
} }

View file

@ -47,7 +47,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
xid = GetXid(); xid = GetXid();
cFYI(1, ("ioctl file %p cmd %u arg %lu", filep, command, arg)); cFYI(1, "ioctl file %p cmd %u arg %lu", filep, command, arg);
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
@ -64,12 +64,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
switch (command) { switch (command) {
case CIFS_IOC_CHECKUMOUNT: case CIFS_IOC_CHECKUMOUNT:
cFYI(1, ("User unmount attempted")); cFYI(1, "User unmount attempted");
if (cifs_sb->mnt_uid == current_uid()) if (cifs_sb->mnt_uid == current_uid())
rc = 0; rc = 0;
else { else {
rc = -EACCES; rc = -EACCES;
cFYI(1, ("uids do not match")); cFYI(1, "uids do not match");
} }
break; break;
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
@ -97,11 +97,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
extAttrBits, &ExtAttrMask);*/ extAttrBits, &ExtAttrMask);*/
} }
cFYI(1, ("set flags not implemented yet")); cFYI(1, "set flags not implemented yet");
break; break;
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
default: default:
cFYI(1, ("unsupported ioctl")); cFYI(1, "unsupported ioctl");
break; break;
} }

View file

@ -139,7 +139,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
if (!full_path) if (!full_path)
goto out; goto out;
cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); cFYI(1, "Full path: %s inode = 0x%p", full_path, inode);
rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path, rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path,
cifs_sb->local_nls); cifs_sb->local_nls);
@ -178,8 +178,8 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
return rc; return rc;
} }
cFYI(1, ("Full path: %s", full_path)); cFYI(1, "Full path: %s", full_path);
cFYI(1, ("symname is %s", symname)); cFYI(1, "symname is %s", symname);
/* BB what if DFS and this volume is on different share? BB */ /* BB what if DFS and this volume is on different share? BB */
if (pTcon->unix_ext) if (pTcon->unix_ext)
@ -198,8 +198,8 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
inode->i_sb, xid, NULL); inode->i_sb, xid, NULL);
if (rc != 0) { if (rc != 0) {
cFYI(1, ("Create symlink ok, getinodeinfo fail rc = %d", cFYI(1, "Create symlink ok, getinodeinfo fail rc = %d",
rc)); rc);
} else { } else {
if (pTcon->nocase) if (pTcon->nocase)
direntry->d_op = &cifs_ci_dentry_ops; direntry->d_op = &cifs_ci_dentry_ops;

View file

@ -51,7 +51,7 @@ _GetXid(void)
if (GlobalTotalActiveXid > GlobalMaxActiveXid) if (GlobalTotalActiveXid > GlobalMaxActiveXid)
GlobalMaxActiveXid = GlobalTotalActiveXid; GlobalMaxActiveXid = GlobalTotalActiveXid;
if (GlobalTotalActiveXid > 65000) if (GlobalTotalActiveXid > 65000)
cFYI(1, ("warning: more than 65000 requests active")); cFYI(1, "warning: more than 65000 requests active");
xid = GlobalCurrentXid++; xid = GlobalCurrentXid++;
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
return xid; return xid;
@ -88,7 +88,7 @@ void
sesInfoFree(struct cifsSesInfo *buf_to_free) sesInfoFree(struct cifsSesInfo *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
cFYI(1, ("Null buffer passed to sesInfoFree")); cFYI(1, "Null buffer passed to sesInfoFree");
return; return;
} }
@ -126,7 +126,7 @@ void
tconInfoFree(struct cifsTconInfo *buf_to_free) tconInfoFree(struct cifsTconInfo *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
cFYI(1, ("Null buffer passed to tconInfoFree")); cFYI(1, "Null buffer passed to tconInfoFree");
return; return;
} }
atomic_dec(&tconInfoAllocCount); atomic_dec(&tconInfoAllocCount);
@ -166,7 +166,7 @@ void
cifs_buf_release(void *buf_to_free) cifs_buf_release(void *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
/* cFYI(1, ("Null buffer passed to cifs_buf_release"));*/ /* cFYI(1, "Null buffer passed to cifs_buf_release");*/
return; return;
} }
mempool_free(buf_to_free, cifs_req_poolp); mempool_free(buf_to_free, cifs_req_poolp);
@ -202,7 +202,7 @@ cifs_small_buf_release(void *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
cFYI(1, ("Null buffer passed to cifs_small_buf_release")); cFYI(1, "Null buffer passed to cifs_small_buf_release");
return; return;
} }
mempool_free(buf_to_free, cifs_sm_req_poolp); mempool_free(buf_to_free, cifs_sm_req_poolp);
@ -345,19 +345,19 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
/* with userid/password pairs found on the smb session */ /* with userid/password pairs found on the smb session */
/* for other target tcp/ip addresses BB */ /* for other target tcp/ip addresses BB */
if (current_fsuid() != treeCon->ses->linux_uid) { if (current_fsuid() != treeCon->ses->linux_uid) {
cFYI(1, ("Multiuser mode and UID " cFYI(1, "Multiuser mode and UID "
"did not match tcon uid")); "did not match tcon uid");
read_lock(&cifs_tcp_ses_lock); read_lock(&cifs_tcp_ses_lock);
list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) { list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) {
ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list); ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list);
if (ses->linux_uid == current_fsuid()) { if (ses->linux_uid == current_fsuid()) {
if (ses->server == treeCon->ses->server) { if (ses->server == treeCon->ses->server) {
cFYI(1, ("found matching uid substitute right smb_uid")); cFYI(1, "found matching uid substitute right smb_uid");
buffer->Uid = ses->Suid; buffer->Uid = ses->Suid;
break; break;
} else { } else {
/* BB eventually call cifs_setup_session here */ /* BB eventually call cifs_setup_session here */
cFYI(1, ("local UID found but no smb sess with this server exists")); cFYI(1, "local UID found but no smb sess with this server exists");
} }
} }
} }
@ -394,17 +394,16 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid)
if (smb->Command == SMB_COM_LOCKING_ANDX) if (smb->Command == SMB_COM_LOCKING_ANDX)
return 0; return 0;
else else
cERROR(1, ("Received Request not response")); cERROR(1, "Received Request not response");
} }
} else { /* bad signature or mid */ } else { /* bad signature or mid */
if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff))
cERROR(1, cERROR(1, "Bad protocol string signature header %x",
("Bad protocol string signature header %x", *(unsigned int *) smb->Protocol);
*(unsigned int *) smb->Protocol));
if (mid != smb->Mid) if (mid != smb->Mid)
cERROR(1, ("Mids do not match")); cERROR(1, "Mids do not match");
} }
cERROR(1, ("bad smb detected. The Mid=%d", smb->Mid)); cERROR(1, "bad smb detected. The Mid=%d", smb->Mid);
return 1; return 1;
} }
@ -413,7 +412,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
{ {
__u32 len = smb->smb_buf_length; __u32 len = smb->smb_buf_length;
__u32 clc_len; /* calculated length */ __u32 clc_len; /* calculated length */
cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len)); cFYI(0, "checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len);
if (length < 2 + sizeof(struct smb_hdr)) { if (length < 2 + sizeof(struct smb_hdr)) {
if ((length >= sizeof(struct smb_hdr) - 1) if ((length >= sizeof(struct smb_hdr) - 1)
@ -437,15 +436,15 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
tmp[sizeof(struct smb_hdr)+1] = 0; tmp[sizeof(struct smb_hdr)+1] = 0;
return 0; return 0;
} }
cERROR(1, ("rcvd invalid byte count (bcc)")); cERROR(1, "rcvd invalid byte count (bcc)");
} else { } else {
cERROR(1, ("Length less than smb header size")); cERROR(1, "Length less than smb header size");
} }
return 1; return 1;
} }
if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
cERROR(1, ("smb length greater than MaxBufSize, mid=%d", cERROR(1, "smb length greater than MaxBufSize, mid=%d",
smb->Mid)); smb->Mid);
return 1; return 1;
} }
@ -454,8 +453,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
clc_len = smbCalcSize_LE(smb); clc_len = smbCalcSize_LE(smb);
if (4 + len != length) { if (4 + len != length) {
cERROR(1, ("Length read does not match RFC1001 length %d", cERROR(1, "Length read does not match RFC1001 length %d",
len)); len);
return 1; return 1;
} }
@ -466,8 +465,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF))
return 0; /* bcc wrapped */ return 0; /* bcc wrapped */
} }
cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d", cFYI(1, "Calculated size %d vs length %d mismatch for mid %d",
clc_len, 4 + len, smb->Mid)); clc_len, 4 + len, smb->Mid);
/* Windows XP can return a few bytes too much, presumably /* Windows XP can return a few bytes too much, presumably
an illegal pad, at the end of byte range lock responses an illegal pad, at the end of byte range lock responses
so we allow for that three byte pad, as long as actual so we allow for that three byte pad, as long as actual
@ -482,8 +481,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
if ((4+len > clc_len) && (len <= clc_len + 512)) if ((4+len > clc_len) && (len <= clc_len + 512))
return 0; return 0;
else { else {
cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d", cERROR(1, "RFC1001 size %d bigger than SMB for Mid=%d",
len, smb->Mid)); len, smb->Mid);
return 1; return 1;
} }
} }
@ -501,7 +500,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
struct cifsFileInfo *netfile; struct cifsFileInfo *netfile;
int rc; int rc;
cFYI(1, ("Checking for oplock break or dnotify response")); cFYI(1, "Checking for oplock break or dnotify response");
if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) &&
(pSMB->hdr.Flags & SMBFLG_RESPONSE)) { (pSMB->hdr.Flags & SMBFLG_RESPONSE)) {
struct smb_com_transaction_change_notify_rsp *pSMBr = struct smb_com_transaction_change_notify_rsp *pSMBr =
@ -513,15 +512,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
pnotify = (struct file_notify_information *) pnotify = (struct file_notify_information *)
((char *)&pSMBr->hdr.Protocol + data_offset); ((char *)&pSMBr->hdr.Protocol + data_offset);
cFYI(1, ("dnotify on %s Action: 0x%x", cFYI(1, "dnotify on %s Action: 0x%x",
pnotify->FileName, pnotify->Action)); pnotify->FileName, pnotify->Action);
/* cifs_dump_mem("Rcvd notify Data: ",buf, /* cifs_dump_mem("Rcvd notify Data: ",buf,
sizeof(struct smb_hdr)+60); */ sizeof(struct smb_hdr)+60); */
return true; return true;
} }
if (pSMBr->hdr.Status.CifsError) { if (pSMBr->hdr.Status.CifsError) {
cFYI(1, ("notify err 0x%d", cFYI(1, "notify err 0x%d",
pSMBr->hdr.Status.CifsError)); pSMBr->hdr.Status.CifsError);
return true; return true;
} }
return false; return false;
@ -535,7 +534,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
large dirty files cached on the client */ large dirty files cached on the client */
if ((NT_STATUS_INVALID_HANDLE) == if ((NT_STATUS_INVALID_HANDLE) ==
le32_to_cpu(pSMB->hdr.Status.CifsError)) { le32_to_cpu(pSMB->hdr.Status.CifsError)) {
cFYI(1, ("invalid handle on oplock break")); cFYI(1, "invalid handle on oplock break");
return true; return true;
} else if (ERRbadfid == } else if (ERRbadfid ==
le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { le16_to_cpu(pSMB->hdr.Status.DosError.Error)) {
@ -547,8 +546,8 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
if (pSMB->hdr.WordCount != 8) if (pSMB->hdr.WordCount != 8)
return false; return false;
cFYI(1, ("oplock type 0x%d level 0x%d", cFYI(1, "oplock type 0x%d level 0x%d",
pSMB->LockType, pSMB->OplockLevel)); pSMB->LockType, pSMB->OplockLevel);
if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE))
return false; return false;
@ -579,15 +578,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
return true; return true;
} }
cFYI(1, ("file id match, oplock break")); cFYI(1, "file id match, oplock break");
pCifsInode = CIFS_I(netfile->pInode); pCifsInode = CIFS_I(netfile->pInode);
pCifsInode->clientCanCacheAll = false; pCifsInode->clientCanCacheAll = false;
if (pSMB->OplockLevel == 0) if (pSMB->OplockLevel == 0)
pCifsInode->clientCanCacheRead = false; pCifsInode->clientCanCacheRead = false;
rc = slow_work_enqueue(&netfile->oplock_break); rc = slow_work_enqueue(&netfile->oplock_break);
if (rc) { if (rc) {
cERROR(1, ("failed to enqueue oplock " cERROR(1, "failed to enqueue oplock "
"break: %d\n", rc)); "break: %d\n", rc);
} else { } else {
netfile->oplock_break_cancelled = false; netfile->oplock_break_cancelled = false;
} }
@ -597,12 +596,12 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
} }
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
read_unlock(&cifs_tcp_ses_lock); read_unlock(&cifs_tcp_ses_lock);
cFYI(1, ("No matching file for oplock break")); cFYI(1, "No matching file for oplock break");
return true; return true;
} }
} }
read_unlock(&cifs_tcp_ses_lock); read_unlock(&cifs_tcp_ses_lock);
cFYI(1, ("Can not process oplock break for non-existent connection")); cFYI(1, "Can not process oplock break for non-existent connection");
return true; return true;
} }
@ -721,11 +720,11 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
{ {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
cERROR(1, ("Autodisabling the use of server inode numbers on " cERROR(1, "Autodisabling the use of server inode numbers on "
"%s. This server doesn't seem to support them " "%s. This server doesn't seem to support them "
"properly. Hardlinks will not be recognized on this " "properly. Hardlinks will not be recognized on this "
"mount. Consider mounting with the \"noserverino\" " "mount. Consider mounting with the \"noserverino\" "
"option to silence this message.", "option to silence this message.",
cifs_sb->tcon->treeName)); cifs_sb->tcon->treeName);
} }
} }

View file

@ -149,7 +149,7 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst)
else if (address_family == AF_INET6) else if (address_family == AF_INET6)
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
cFYI(DBG2, ("address conversion returned %d for %s", ret, cp)); cFYI(DBG2, "address conversion returned %d for %s", ret, cp);
if (ret > 0) if (ret > 0)
ret = 1; ret = 1;
return ret; return ret;
@ -870,8 +870,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
} }
/* else ERRHRD class errors or junk - return EIO */ /* else ERRHRD class errors or junk - return EIO */
cFYI(1, ("Mapping smb error code %d to POSIX err %d", cFYI(1, "Mapping smb error code %d to POSIX err %d",
smberrcode, rc)); smberrcode, rc);
/* generic corrective action e.g. reconnect SMB session on /* generic corrective action e.g. reconnect SMB session on
* ERRbaduid could be added */ * ERRbaduid could be added */
@ -940,20 +940,20 @@ struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
SMB_TIME *st = (SMB_TIME *)&time; SMB_TIME *st = (SMB_TIME *)&time;
SMB_DATE *sd = (SMB_DATE *)&date; SMB_DATE *sd = (SMB_DATE *)&date;
cFYI(1, ("date %d time %d", date, time)); cFYI(1, "date %d time %d", date, time);
sec = 2 * st->TwoSeconds; sec = 2 * st->TwoSeconds;
min = st->Minutes; min = st->Minutes;
if ((sec > 59) || (min > 59)) if ((sec > 59) || (min > 59))
cERROR(1, ("illegal time min %d sec %d", min, sec)); cERROR(1, "illegal time min %d sec %d", min, sec);
sec += (min * 60); sec += (min * 60);
sec += 60 * 60 * st->Hours; sec += 60 * 60 * st->Hours;
if (st->Hours > 24) if (st->Hours > 24)
cERROR(1, ("illegal hours %d", st->Hours)); cERROR(1, "illegal hours %d", st->Hours);
days = sd->Day; days = sd->Day;
month = sd->Month; month = sd->Month;
if ((days > 31) || (month > 12)) { if ((days > 31) || (month > 12)) {
cERROR(1, ("illegal date, month %d day: %d", month, days)); cERROR(1, "illegal date, month %d day: %d", month, days);
if (month > 12) if (month > 12)
month = 12; month = 12;
} }
@ -979,7 +979,7 @@ struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
ts.tv_sec = sec + offset; ts.tv_sec = sec + offset;
/* cFYI(1,("sec after cnvrt dos to unix time %d",sec)); */ /* cFYI(1, "sec after cnvrt dos to unix time %d",sec); */
ts.tv_nsec = 0; ts.tv_nsec = 0;
return ts; return ts;

View file

@ -47,15 +47,15 @@ static void dump_cifs_file_struct(struct file *file, char *label)
if (file) { if (file) {
cf = file->private_data; cf = file->private_data;
if (cf == NULL) { if (cf == NULL) {
cFYI(1, ("empty cifs private file data")); cFYI(1, "empty cifs private file data");
return; return;
} }
if (cf->invalidHandle) if (cf->invalidHandle)
cFYI(1, ("invalid handle")); cFYI(1, "invalid handle");
if (cf->srch_inf.endOfSearch) if (cf->srch_inf.endOfSearch)
cFYI(1, ("end of search")); cFYI(1, "end of search");
if (cf->srch_inf.emptyDir) if (cf->srch_inf.emptyDir)
cFYI(1, ("empty dir")); cFYI(1, "empty dir");
} }
} }
#else #else
@ -76,7 +76,7 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
struct inode *inode; struct inode *inode;
struct super_block *sb = parent->d_inode->i_sb; struct super_block *sb = parent->d_inode->i_sb;
cFYI(1, ("For %s", name->name)); cFYI(1, "For %s", name->name);
if (parent->d_op && parent->d_op->d_hash) if (parent->d_op && parent->d_op->d_hash)
parent->d_op->d_hash(parent, name); parent->d_op->d_hash(parent, name);
@ -214,7 +214,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
fid, fid,
cifs_sb->local_nls); cifs_sb->local_nls);
if (CIFSSMBClose(xid, ptcon, fid)) { if (CIFSSMBClose(xid, ptcon, fid)) {
cFYI(1, ("Error closing temporary reparsepoint open)")); cFYI(1, "Error closing temporary reparsepoint open");
} }
} }
} }
@ -252,7 +252,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
if (full_path == NULL) if (full_path == NULL)
return -ENOMEM; return -ENOMEM;
cFYI(1, ("Full path: %s start at: %lld", full_path, file->f_pos)); cFYI(1, "Full path: %s start at: %lld", full_path, file->f_pos);
ffirst_retry: ffirst_retry:
/* test for Unix extensions */ /* test for Unix extensions */
@ -297,7 +297,7 @@ static int cifs_unicode_bytelen(char *str)
if (ustr[len] == 0) if (ustr[len] == 0)
return len << 1; return len << 1;
} }
cFYI(1, ("Unicode string longer than PATH_MAX found")); cFYI(1, "Unicode string longer than PATH_MAX found");
return len << 1; return len << 1;
} }
@ -314,19 +314,18 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
pfData->FileNameLength; pfData->FileNameLength;
} else } else
new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset);
cFYI(1, ("new entry %p old entry %p", new_entry, old_entry)); cFYI(1, "new entry %p old entry %p", new_entry, old_entry);
/* validate that new_entry is not past end of SMB */ /* validate that new_entry is not past end of SMB */
if (new_entry >= end_of_smb) { if (new_entry >= end_of_smb) {
cERROR(1, cERROR(1, "search entry %p began after end of SMB %p old entry %p",
("search entry %p began after end of SMB %p old entry %p", new_entry, end_of_smb, old_entry);
new_entry, end_of_smb, old_entry));
return NULL; return NULL;
} else if (((level == SMB_FIND_FILE_INFO_STANDARD) && } else if (((level == SMB_FIND_FILE_INFO_STANDARD) &&
(new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb))
|| ((level != SMB_FIND_FILE_INFO_STANDARD) && || ((level != SMB_FIND_FILE_INFO_STANDARD) &&
(new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) {
cERROR(1, ("search entry %p extends after end of SMB %p", cERROR(1, "search entry %p extends after end of SMB %p",
new_entry, end_of_smb)); new_entry, end_of_smb);
return NULL; return NULL;
} else } else
return new_entry; return new_entry;
@ -380,8 +379,8 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = pFindData->FileNameLength; len = pFindData->FileNameLength;
} else { } else {
cFYI(1, ("Unknown findfirst level %d", cFYI(1, "Unknown findfirst level %d",
cfile->srch_inf.info_level)); cfile->srch_inf.info_level);
} }
if (filename) { if (filename) {
@ -481,7 +480,7 @@ static int cifs_save_resume_key(const char *current_entry,
len = (unsigned int)pFindData->FileNameLength; len = (unsigned int)pFindData->FileNameLength;
cifsFile->srch_inf.resume_key = pFindData->ResumeKey; cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
} else { } else {
cFYI(1, ("Unknown findfirst level %d", level)); cFYI(1, "Unknown findfirst level %d", level);
return -EINVAL; return -EINVAL;
} }
cifsFile->srch_inf.resume_name_len = len; cifsFile->srch_inf.resume_name_len = len;
@ -525,7 +524,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
is_dir_changed(file)) || is_dir_changed(file)) ||
(index_to_find < first_entry_in_buffer)) { (index_to_find < first_entry_in_buffer)) {
/* close and restart search */ /* close and restart search */
cFYI(1, ("search backing up - close and restart search")); cFYI(1, "search backing up - close and restart search");
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
if (!cifsFile->srch_inf.endOfSearch && if (!cifsFile->srch_inf.endOfSearch &&
!cifsFile->invalidHandle) { !cifsFile->invalidHandle) {
@ -535,7 +534,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
} else } else
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
if (cifsFile->srch_inf.ntwrk_buf_start) { if (cifsFile->srch_inf.ntwrk_buf_start) {
cFYI(1, ("freeing SMB ff cache buf on search rewind")); cFYI(1, "freeing SMB ff cache buf on search rewind");
if (cifsFile->srch_inf.smallBuf) if (cifsFile->srch_inf.smallBuf)
cifs_small_buf_release(cifsFile->srch_inf. cifs_small_buf_release(cifsFile->srch_inf.
ntwrk_buf_start); ntwrk_buf_start);
@ -546,8 +545,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
} }
rc = initiate_cifs_search(xid, file); rc = initiate_cifs_search(xid, file);
if (rc) { if (rc) {
cFYI(1, ("error %d reinitiating a search on rewind", cFYI(1, "error %d reinitiating a search on rewind",
rc)); rc);
return rc; return rc;
} }
cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
@ -555,7 +554,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
(rc == 0) && !cifsFile->srch_inf.endOfSearch) { (rc == 0) && !cifsFile->srch_inf.endOfSearch) {
cFYI(1, ("calling findnext2")); cFYI(1, "calling findnext2");
rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
&cifsFile->srch_inf); &cifsFile->srch_inf);
cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
@ -575,7 +574,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry
- cifsFile->srch_inf.entries_in_buffer; - cifsFile->srch_inf.entries_in_buffer;
pos_in_buf = index_to_find - first_entry_in_buffer; pos_in_buf = index_to_find - first_entry_in_buffer;
cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); cFYI(1, "found entry - pos_in_buf %d", pos_in_buf);
for (i = 0; (i < (pos_in_buf)) && (current_entry != NULL); i++) { for (i = 0; (i < (pos_in_buf)) && (current_entry != NULL); i++) {
/* go entry by entry figuring out which is first */ /* go entry by entry figuring out which is first */
@ -584,19 +583,19 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
} }
if ((current_entry == NULL) && (i < pos_in_buf)) { if ((current_entry == NULL) && (i < pos_in_buf)) {
/* BB fixme - check if we should flag this error */ /* BB fixme - check if we should flag this error */
cERROR(1, ("reached end of buf searching for pos in buf" cERROR(1, "reached end of buf searching for pos in buf"
" %d index to find %lld rc %d", " %d index to find %lld rc %d",
pos_in_buf, index_to_find, rc)); pos_in_buf, index_to_find, rc);
} }
rc = 0; rc = 0;
*ppCurrentEntry = current_entry; *ppCurrentEntry = current_entry;
} else { } else {
cFYI(1, ("index not in buffer - could not findnext into it")); cFYI(1, "index not in buffer - could not findnext into it");
return 0; return 0;
} }
if (pos_in_buf >= cifsFile->srch_inf.entries_in_buffer) { if (pos_in_buf >= cifsFile->srch_inf.entries_in_buffer) {
cFYI(1, ("can not return entries pos_in_buf beyond last")); cFYI(1, "can not return entries pos_in_buf beyond last");
*num_to_ret = 0; *num_to_ret = 0;
} else } else
*num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf; *num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf;
@ -656,12 +655,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
/* one byte length, no name conversion */ /* one byte length, no name conversion */
len = (unsigned int)pFindData->FileNameLength; len = (unsigned int)pFindData->FileNameLength;
} else { } else {
cFYI(1, ("Unknown findfirst level %d", level)); cFYI(1, "Unknown findfirst level %d", level);
return -EINVAL; return -EINVAL;
} }
if (len > max_len) { if (len > max_len) {
cERROR(1, ("bad search response length %d past smb end", len)); cERROR(1, "bad search response length %d past smb end", len);
return -EINVAL; return -EINVAL;
} }
@ -754,7 +753,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir,
* case already. Why should we be clobbering other errors from it? * case already. Why should we be clobbering other errors from it?
*/ */
if (rc) { if (rc) {
cFYI(1, ("filldir rc = %d", rc)); cFYI(1, "filldir rc = %d", rc);
rc = -EOVERFLOW; rc = -EOVERFLOW;
} }
dput(tmp_dentry); dput(tmp_dentry);
@ -786,7 +785,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
case 0: case 0:
if (filldir(direntry, ".", 1, file->f_pos, if (filldir(direntry, ".", 1, file->f_pos,
file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) { file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
cERROR(1, ("Filldir for current dir failed")); cERROR(1, "Filldir for current dir failed");
rc = -ENOMEM; rc = -ENOMEM;
break; break;
} }
@ -794,7 +793,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
case 1: case 1:
if (filldir(direntry, "..", 2, file->f_pos, if (filldir(direntry, "..", 2, file->f_pos,
file->f_path.dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { file->f_path.dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
cERROR(1, ("Filldir for parent dir failed")); cERROR(1, "Filldir for parent dir failed");
rc = -ENOMEM; rc = -ENOMEM;
break; break;
} }
@ -807,7 +806,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
if (file->private_data == NULL) { if (file->private_data == NULL) {
rc = initiate_cifs_search(xid, file); rc = initiate_cifs_search(xid, file);
cFYI(1, ("initiate cifs search rc %d", rc)); cFYI(1, "initiate cifs search rc %d", rc);
if (rc) { if (rc) {
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -821,7 +820,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile = file->private_data; cifsFile = file->private_data;
if (cifsFile->srch_inf.endOfSearch) { if (cifsFile->srch_inf.endOfSearch) {
if (cifsFile->srch_inf.emptyDir) { if (cifsFile->srch_inf.emptyDir) {
cFYI(1, ("End of search, empty dir")); cFYI(1, "End of search, empty dir");
rc = 0; rc = 0;
break; break;
} }
@ -833,16 +832,16 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
rc = find_cifs_entry(xid, pTcon, file, rc = find_cifs_entry(xid, pTcon, file,
&current_entry, &num_to_fill); &current_entry, &num_to_fill);
if (rc) { if (rc) {
cFYI(1, ("fce error %d", rc)); cFYI(1, "fce error %d", rc);
goto rddir2_exit; goto rddir2_exit;
} else if (current_entry != NULL) { } else if (current_entry != NULL) {
cFYI(1, ("entry %lld found", file->f_pos)); cFYI(1, "entry %lld found", file->f_pos);
} else { } else {
cFYI(1, ("could not find entry")); cFYI(1, "could not find entry");
goto rddir2_exit; goto rddir2_exit;
} }
cFYI(1, ("loop through %d times filling dir for net buf %p", cFYI(1, "loop through %d times filling dir for net buf %p",
num_to_fill, cifsFile->srch_inf.ntwrk_buf_start)); num_to_fill, cifsFile->srch_inf.ntwrk_buf_start);
max_len = smbCalcSize((struct smb_hdr *) max_len = smbCalcSize((struct smb_hdr *)
cifsFile->srch_inf.ntwrk_buf_start); cifsFile->srch_inf.ntwrk_buf_start);
end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len;
@ -851,8 +850,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
for (i = 0; (i < num_to_fill) && (rc == 0); i++) { for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
if (current_entry == NULL) { if (current_entry == NULL) {
/* evaluate whether this case is an error */ /* evaluate whether this case is an error */
cERROR(1, ("past SMB end, num to fill %d i %d", cERROR(1, "past SMB end, num to fill %d i %d",
num_to_fill, i)); num_to_fill, i);
break; break;
} }
/* if buggy server returns . and .. late do /* if buggy server returns . and .. late do
@ -867,8 +866,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
file->f_pos++; file->f_pos++;
if (file->f_pos == if (file->f_pos ==
cifsFile->srch_inf.index_of_last_entry) { cifsFile->srch_inf.index_of_last_entry) {
cFYI(1, ("last entry in buf at pos %lld %s", cFYI(1, "last entry in buf at pos %lld %s",
file->f_pos, tmp_buf)); file->f_pos, tmp_buf);
cifs_save_resume_key(current_entry, cifsFile); cifs_save_resume_key(current_entry, cifsFile);
break; break;
} else } else

View file

@ -35,9 +35,11 @@
extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
unsigned char *p24); unsigned char *p24);
/* Checks if this is the first smb session to be reconnected after /*
the socket has been reestablished (so we know whether to use vc 0). * Checks if this is the first smb session to be reconnected after
Called while holding the cifs_tcp_ses_lock, so do not block */ * the socket has been reestablished (so we know whether to use vc 0).
* Called while holding the cifs_tcp_ses_lock, so do not block
*/
static bool is_first_ses_reconnect(struct cifsSesInfo *ses) static bool is_first_ses_reconnect(struct cifsSesInfo *ses)
{ {
struct list_head *tmp; struct list_head *tmp;
@ -284,7 +286,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
int len; int len;
char *data = *pbcc_area; char *data = *pbcc_area;
cFYI(1, ("bleft %d", bleft)); cFYI(1, "bleft %d", bleft);
/* /*
* Windows servers do not always double null terminate their final * Windows servers do not always double null terminate their final
@ -301,7 +303,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
kfree(ses->serverOS); kfree(ses->serverOS);
ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
cFYI(1, ("serverOS=%s", ses->serverOS)); cFYI(1, "serverOS=%s", ses->serverOS);
len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2; len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2;
data += len; data += len;
bleft -= len; bleft -= len;
@ -310,7 +312,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
kfree(ses->serverNOS); kfree(ses->serverNOS);
ses->serverNOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); ses->serverNOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
cFYI(1, ("serverNOS=%s", ses->serverNOS)); cFYI(1, "serverNOS=%s", ses->serverNOS);
len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2; len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2;
data += len; data += len;
bleft -= len; bleft -= len;
@ -319,7 +321,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
kfree(ses->serverDomain); kfree(ses->serverDomain);
ses->serverDomain = cifs_strndup_from_ucs(data, bleft, true, nls_cp); ses->serverDomain = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
cFYI(1, ("serverDomain=%s", ses->serverDomain)); cFYI(1, "serverDomain=%s", ses->serverDomain);
return; return;
} }
@ -332,7 +334,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
int len; int len;
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
cFYI(1, ("decode sessetup ascii. bleft %d", bleft)); cFYI(1, "decode sessetup ascii. bleft %d", bleft);
len = strnlen(bcc_ptr, bleft); len = strnlen(bcc_ptr, bleft);
if (len >= bleft) if (len >= bleft)
@ -344,7 +346,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
if (ses->serverOS) if (ses->serverOS)
strncpy(ses->serverOS, bcc_ptr, len); strncpy(ses->serverOS, bcc_ptr, len);
if (strncmp(ses->serverOS, "OS/2", 4) == 0) { if (strncmp(ses->serverOS, "OS/2", 4) == 0) {
cFYI(1, ("OS/2 server")); cFYI(1, "OS/2 server");
ses->flags |= CIFS_SES_OS2; ses->flags |= CIFS_SES_OS2;
} }
@ -373,7 +375,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
/* BB For newer servers which do not support Unicode, /* BB For newer servers which do not support Unicode,
but thus do return domain here we could add parsing but thus do return domain here we could add parsing
for it later, but it is not very important */ for it later, but it is not very important */
cFYI(1, ("ascii: bytes left %d", bleft)); cFYI(1, "ascii: bytes left %d", bleft);
return rc; return rc;
} }
@ -384,16 +386,16 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr;
if (blob_len < sizeof(CHALLENGE_MESSAGE)) { if (blob_len < sizeof(CHALLENGE_MESSAGE)) {
cERROR(1, ("challenge blob len %d too small", blob_len)); cERROR(1, "challenge blob len %d too small", blob_len);
return -EINVAL; return -EINVAL;
} }
if (memcmp(pblob->Signature, "NTLMSSP", 8)) { if (memcmp(pblob->Signature, "NTLMSSP", 8)) {
cERROR(1, ("blob signature incorrect %s", pblob->Signature)); cERROR(1, "blob signature incorrect %s", pblob->Signature);
return -EINVAL; return -EINVAL;
} }
if (pblob->MessageType != NtLmChallenge) { if (pblob->MessageType != NtLmChallenge) {
cERROR(1, ("Incorrect message type %d", pblob->MessageType)); cERROR(1, "Incorrect message type %d", pblob->MessageType);
return -EINVAL; return -EINVAL;
} }
@ -447,7 +449,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
This function returns the length of the data in the blob */ This function returns the length of the data in the blob */
static int build_ntlmssp_auth_blob(unsigned char *pbuffer, static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
struct cifsSesInfo *ses, struct cifsSesInfo *ses,
const struct nls_table *nls_cp, int first) const struct nls_table *nls_cp, bool first)
{ {
AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer;
__u32 flags; __u32 flags;
@ -546,7 +548,7 @@ static void setup_ntlmssp_neg_req(SESSION_SETUP_ANDX *pSMB,
static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB, static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB,
struct cifsSesInfo *ses, struct cifsSesInfo *ses,
const struct nls_table *nls, int first_time) const struct nls_table *nls, bool first_time)
{ {
int bloblen; int bloblen;
@ -559,8 +561,8 @@ static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB,
#endif #endif
int int
CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int rc = 0; int rc = 0;
int wct; int wct;
@ -577,13 +579,18 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
int bytes_remaining; int bytes_remaining;
struct key *spnego_key = NULL; struct key *spnego_key = NULL;
__le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */
bool first_time;
if (ses == NULL) if (ses == NULL)
return -EINVAL; return -EINVAL;
read_lock(&cifs_tcp_ses_lock);
first_time = is_first_ses_reconnect(ses);
read_unlock(&cifs_tcp_ses_lock);
type = ses->server->secType; type = ses->server->secType;
cFYI(1, ("sess setup type %d", type)); cFYI(1, "sess setup type %d", type);
ssetup_ntlmssp_authenticate: ssetup_ntlmssp_authenticate:
if (phase == NtLmChallenge) if (phase == NtLmChallenge)
phase = NtLmAuthenticate; /* if ntlmssp, now final phase */ phase = NtLmAuthenticate; /* if ntlmssp, now final phase */
@ -664,7 +671,7 @@ ssetup_ntlmssp_authenticate:
changed to do higher than lanman dialect and changed to do higher than lanman dialect and
we reconnected would we ever calc signing_key? */ we reconnected would we ever calc signing_key? */
cFYI(1, ("Negotiating LANMAN setting up strings")); cFYI(1, "Negotiating LANMAN setting up strings");
/* Unicode not allowed for LANMAN dialects */ /* Unicode not allowed for LANMAN dialects */
ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
#endif #endif
@ -744,7 +751,7 @@ ssetup_ntlmssp_authenticate:
unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
} else } else
ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
} else if (type == Kerberos || type == MSKerberos) { } else if (type == Kerberos) {
#ifdef CONFIG_CIFS_UPCALL #ifdef CONFIG_CIFS_UPCALL
struct cifs_spnego_msg *msg; struct cifs_spnego_msg *msg;
spnego_key = cifs_get_spnego_key(ses); spnego_key = cifs_get_spnego_key(ses);
@ -758,17 +765,17 @@ ssetup_ntlmssp_authenticate:
/* check version field to make sure that cifs.upcall is /* check version field to make sure that cifs.upcall is
sending us a response in an expected form */ sending us a response in an expected form */
if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) {
cERROR(1, ("incorrect version of cifs.upcall (expected" cERROR(1, "incorrect version of cifs.upcall (expected"
" %d but got %d)", " %d but got %d)",
CIFS_SPNEGO_UPCALL_VERSION, msg->version)); CIFS_SPNEGO_UPCALL_VERSION, msg->version);
rc = -EKEYREJECTED; rc = -EKEYREJECTED;
goto ssetup_exit; goto ssetup_exit;
} }
/* bail out if key is too long */ /* bail out if key is too long */
if (msg->sesskey_len > if (msg->sesskey_len >
sizeof(ses->server->mac_signing_key.data.krb5)) { sizeof(ses->server->mac_signing_key.data.krb5)) {
cERROR(1, ("Kerberos signing key too long (%u bytes)", cERROR(1, "Kerberos signing key too long (%u bytes)",
msg->sesskey_len)); msg->sesskey_len);
rc = -EOVERFLOW; rc = -EOVERFLOW;
goto ssetup_exit; goto ssetup_exit;
} }
@ -796,7 +803,7 @@ ssetup_ntlmssp_authenticate:
/* BB: is this right? */ /* BB: is this right? */
ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
#else /* ! CONFIG_CIFS_UPCALL */ #else /* ! CONFIG_CIFS_UPCALL */
cERROR(1, ("Kerberos negotiated but upcall support disabled!")); cERROR(1, "Kerberos negotiated but upcall support disabled!");
rc = -ENOSYS; rc = -ENOSYS;
goto ssetup_exit; goto ssetup_exit;
#endif /* CONFIG_CIFS_UPCALL */ #endif /* CONFIG_CIFS_UPCALL */
@ -804,12 +811,12 @@ ssetup_ntlmssp_authenticate:
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
if (type == RawNTLMSSP) { if (type == RawNTLMSSP) {
if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) { if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
cERROR(1, ("NTLMSSP requires Unicode support")); cERROR(1, "NTLMSSP requires Unicode support");
rc = -ENOSYS; rc = -ENOSYS;
goto ssetup_exit; goto ssetup_exit;
} }
cFYI(1, ("ntlmssp session setup phase %d", phase)); cFYI(1, "ntlmssp session setup phase %d", phase);
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
capabilities |= CAP_EXTENDED_SECURITY; capabilities |= CAP_EXTENDED_SECURITY;
pSMB->req.Capabilities |= cpu_to_le32(capabilities); pSMB->req.Capabilities |= cpu_to_le32(capabilities);
@ -827,7 +834,7 @@ ssetup_ntlmssp_authenticate:
on the response (challenge) */ on the response (challenge) */
smb_buf->Uid = ses->Suid; smb_buf->Uid = ses->Suid;
} else { } else {
cERROR(1, ("invalid phase %d", phase)); cERROR(1, "invalid phase %d", phase);
rc = -ENOSYS; rc = -ENOSYS;
goto ssetup_exit; goto ssetup_exit;
} }
@ -839,12 +846,12 @@ ssetup_ntlmssp_authenticate:
} }
unicode_oslm_strings(&bcc_ptr, nls_cp); unicode_oslm_strings(&bcc_ptr, nls_cp);
} else { } else {
cERROR(1, ("secType %d not supported!", type)); cERROR(1, "secType %d not supported!", type);
rc = -ENOSYS; rc = -ENOSYS;
goto ssetup_exit; goto ssetup_exit;
} }
#else #else
cERROR(1, ("secType %d not supported!", type)); cERROR(1, "secType %d not supported!", type);
rc = -ENOSYS; rc = -ENOSYS;
goto ssetup_exit; goto ssetup_exit;
#endif #endif
@ -862,7 +869,7 @@ ssetup_ntlmssp_authenticate:
CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR); CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR);
/* SMB request buf freed in SendReceive2 */ /* SMB request buf freed in SendReceive2 */
cFYI(1, ("ssetup rc from sendrecv2 is %d", rc)); cFYI(1, "ssetup rc from sendrecv2 is %d", rc);
pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base; pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base;
smb_buf = (struct smb_hdr *)iov[0].iov_base; smb_buf = (struct smb_hdr *)iov[0].iov_base;
@ -870,7 +877,7 @@ ssetup_ntlmssp_authenticate:
if ((type == RawNTLMSSP) && (smb_buf->Status.CifsError == if ((type == RawNTLMSSP) && (smb_buf->Status.CifsError ==
cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))) { cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))) {
if (phase != NtLmNegotiate) { if (phase != NtLmNegotiate) {
cERROR(1, ("Unexpected more processing error")); cERROR(1, "Unexpected more processing error");
goto ssetup_exit; goto ssetup_exit;
} }
/* NTLMSSP Negotiate sent now processing challenge (response) */ /* NTLMSSP Negotiate sent now processing challenge (response) */
@ -882,14 +889,14 @@ ssetup_ntlmssp_authenticate:
if ((smb_buf->WordCount != 3) && (smb_buf->WordCount != 4)) { if ((smb_buf->WordCount != 3) && (smb_buf->WordCount != 4)) {
rc = -EIO; rc = -EIO;
cERROR(1, ("bad word count %d", smb_buf->WordCount)); cERROR(1, "bad word count %d", smb_buf->WordCount);
goto ssetup_exit; goto ssetup_exit;
} }
action = le16_to_cpu(pSMB->resp.Action); action = le16_to_cpu(pSMB->resp.Action);
if (action & GUEST_LOGIN) if (action & GUEST_LOGIN)
cFYI(1, ("Guest login")); /* BB mark SesInfo struct? */ cFYI(1, "Guest login"); /* BB mark SesInfo struct? */
ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */
cFYI(1, ("UID = %d ", ses->Suid)); cFYI(1, "UID = %d ", ses->Suid);
/* response can have either 3 or 4 word count - Samba sends 3 */ /* response can have either 3 or 4 word count - Samba sends 3 */
/* and lanman response is 3 */ /* and lanman response is 3 */
bytes_remaining = BCC(smb_buf); bytes_remaining = BCC(smb_buf);
@ -899,7 +906,7 @@ ssetup_ntlmssp_authenticate:
__u16 blob_len; __u16 blob_len;
blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength); blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength);
if (blob_len > bytes_remaining) { if (blob_len > bytes_remaining) {
cERROR(1, ("bad security blob length %d", blob_len)); cERROR(1, "bad security blob length %d", blob_len);
rc = -EINVAL; rc = -EINVAL;
goto ssetup_exit; goto ssetup_exit;
} }
@ -933,7 +940,7 @@ ssetup_exit:
} }
kfree(str_area); kfree(str_area);
if (resp_buf_type == CIFS_SMALL_BUFFER) { if (resp_buf_type == CIFS_SMALL_BUFFER) {
cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base)); cFYI(1, "ssetup freeing small buf %p", iov[0].iov_base);
cifs_small_buf_release(iov[0].iov_base); cifs_small_buf_release(iov[0].iov_base);
} else if (resp_buf_type == CIFS_LARGE_BUFFER) } else if (resp_buf_type == CIFS_LARGE_BUFFER)
cifs_buf_release(iov[0].iov_base); cifs_buf_release(iov[0].iov_base);

View file

@ -35,7 +35,6 @@
#include "cifs_debug.h" #include "cifs_debug.h"
extern mempool_t *cifs_mid_poolp; extern mempool_t *cifs_mid_poolp;
extern struct kmem_cache *cifs_oplock_cachep;
static struct mid_q_entry * static struct mid_q_entry *
AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
@ -43,7 +42,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
struct mid_q_entry *temp; struct mid_q_entry *temp;
if (server == NULL) { if (server == NULL) {
cERROR(1, ("Null TCP session in AllocMidQEntry")); cERROR(1, "Null TCP session in AllocMidQEntry");
return NULL; return NULL;
} }
@ -55,7 +54,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
temp->mid = smb_buffer->Mid; /* always LE */ temp->mid = smb_buffer->Mid; /* always LE */
temp->pid = current->pid; temp->pid = current->pid;
temp->command = smb_buffer->Command; temp->command = smb_buffer->Command;
cFYI(1, ("For smb_command %d", temp->command)); cFYI(1, "For smb_command %d", temp->command);
/* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
/* when mid allocated can be before when sent */ /* when mid allocated can be before when sent */
temp->when_alloc = jiffies; temp->when_alloc = jiffies;
@ -140,7 +139,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
total_len += iov[i].iov_len; total_len += iov[i].iov_len;
smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length);
cFYI(1, ("Sending smb: total_len %d", total_len)); cFYI(1, "Sending smb: total_len %d", total_len);
dump_smb(smb_buffer, len); dump_smb(smb_buffer, len);
i = 0; i = 0;
@ -168,9 +167,8 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
reconnect which may clear the network problem. reconnect which may clear the network problem.
*/ */
if ((i >= 14) || (!server->noblocksnd && (i > 2))) { if ((i >= 14) || (!server->noblocksnd && (i > 2))) {
cERROR(1, cERROR(1, "sends on sock %p stuck for 15 seconds",
("sends on sock %p stuck for 15 seconds", ssocket);
ssocket));
rc = -EAGAIN; rc = -EAGAIN;
break; break;
} }
@ -184,13 +182,13 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
total_len = 0; total_len = 0;
break; break;
} else if (rc > total_len) { } else if (rc > total_len) {
cERROR(1, ("sent %d requested %d", rc, total_len)); cERROR(1, "sent %d requested %d", rc, total_len);
break; break;
} }
if (rc == 0) { if (rc == 0) {
/* should never happen, letting socket clear before /* should never happen, letting socket clear before
retrying is our only obvious option here */ retrying is our only obvious option here */
cERROR(1, ("tcp sent no data")); cERROR(1, "tcp sent no data");
msleep(500); msleep(500);
continue; continue;
} }
@ -213,8 +211,8 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
} }
if ((total_len > 0) && (total_len != smb_buf_length + 4)) { if ((total_len > 0) && (total_len != smb_buf_length + 4)) {
cFYI(1, ("partial send (%d remaining), terminating session", cFYI(1, "partial send (%d remaining), terminating session",
total_len)); total_len);
/* If we have only sent part of an SMB then the next SMB /* If we have only sent part of an SMB then the next SMB
could be taken as the remainder of this one. We need could be taken as the remainder of this one. We need
to kill the socket so the server throws away the partial to kill the socket so the server throws away the partial
@ -223,7 +221,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
} }
if (rc < 0) { if (rc < 0) {
cERROR(1, ("Error %d sending data on socket to server", rc)); cERROR(1, "Error %d sending data on socket to server", rc);
} else } else
rc = 0; rc = 0;
@ -296,7 +294,7 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
} }
if (ses->server->tcpStatus == CifsNeedReconnect) { if (ses->server->tcpStatus == CifsNeedReconnect) {
cFYI(1, ("tcp session dead - return to caller to retry")); cFYI(1, "tcp session dead - return to caller to retry");
return -EAGAIN; return -EAGAIN;
} }
@ -348,7 +346,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
lrt += time_to_wait; lrt += time_to_wait;
if (time_after(jiffies, lrt)) { if (time_after(jiffies, lrt)) {
/* No replies for time_to_wait. */ /* No replies for time_to_wait. */
cERROR(1, ("server not responding")); cERROR(1, "server not responding");
return -1; return -1;
} }
} else { } else {
@ -379,7 +377,7 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
iov[0].iov_len = in_buf->smb_buf_length + 4; iov[0].iov_len = in_buf->smb_buf_length + 4;
flags |= CIFS_NO_RESP; flags |= CIFS_NO_RESP;
rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
cFYI(DBG2, ("SendRcvNoRsp flags %d rc %d", flags, rc)); cFYI(DBG2, "SendRcvNoRsp flags %d rc %d", flags, rc);
return rc; return rc;
} }
@ -402,7 +400,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
if ((ses == NULL) || (ses->server == NULL)) { if ((ses == NULL) || (ses->server == NULL)) {
cifs_small_buf_release(in_buf); cifs_small_buf_release(in_buf);
cERROR(1, ("Null session")); cERROR(1, "Null session");
return -EIO; return -EIO;
} }
@ -471,7 +469,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
else if (long_op == CIFS_BLOCKING_OP) else if (long_op == CIFS_BLOCKING_OP)
timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */ timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */
else { else {
cERROR(1, ("unknown timeout flag %d", long_op)); cERROR(1, "unknown timeout flag %d", long_op);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -490,8 +488,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
if (midQ->resp_buf == NULL) { if (midQ->resp_buf == NULL) {
cERROR(1, ("No response to cmd %d mid %d", cERROR(1, "No response to cmd %d mid %d",
midQ->command, midQ->mid)); midQ->command, midQ->mid);
if (midQ->midState == MID_REQUEST_SUBMITTED) { if (midQ->midState == MID_REQUEST_SUBMITTED) {
if (ses->server->tcpStatus == CifsExiting) if (ses->server->tcpStatus == CifsExiting)
rc = -EHOSTDOWN; rc = -EHOSTDOWN;
@ -504,7 +502,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
if (rc != -EHOSTDOWN) { if (rc != -EHOSTDOWN) {
if (midQ->midState == MID_RETRY_NEEDED) { if (midQ->midState == MID_RETRY_NEEDED) {
rc = -EAGAIN; rc = -EAGAIN;
cFYI(1, ("marking request for retry")); cFYI(1, "marking request for retry");
} else { } else {
rc = -EIO; rc = -EIO;
} }
@ -521,8 +519,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
receive_len = midQ->resp_buf->smb_buf_length; receive_len = midQ->resp_buf->smb_buf_length;
if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
cERROR(1, ("Frame too large received. Length: %d Xid: %d", cERROR(1, "Frame too large received. Length: %d Xid: %d",
receive_len, xid)); receive_len, xid);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -548,7 +546,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
&ses->server->mac_signing_key, &ses->server->mac_signing_key,
midQ->sequence_number+1); midQ->sequence_number+1);
if (rc) { if (rc) {
cERROR(1, ("Unexpected SMB signature")); cERROR(1, "Unexpected SMB signature");
/* BB FIXME add code to kill session */ /* BB FIXME add code to kill session */
} }
} }
@ -569,7 +567,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
DeleteMidQEntry */ DeleteMidQEntry */
} else { } else {
rc = -EIO; rc = -EIO;
cFYI(1, ("Bad MID state?")); cFYI(1, "Bad MID state?");
} }
out: out:
@ -591,11 +589,11 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
struct mid_q_entry *midQ; struct mid_q_entry *midQ;
if (ses == NULL) { if (ses == NULL) {
cERROR(1, ("Null smb session")); cERROR(1, "Null smb session");
return -EIO; return -EIO;
} }
if (ses->server == NULL) { if (ses->server == NULL) {
cERROR(1, ("Null tcp session")); cERROR(1, "Null tcp session");
return -EIO; return -EIO;
} }
@ -607,8 +605,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
use ses->maxReq */ use ses->maxReq */
if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
cERROR(1, ("Illegal length, greater than maximum frame, %d", cERROR(1, "Illegal length, greater than maximum frame, %d",
in_buf->smb_buf_length)); in_buf->smb_buf_length);
return -EIO; return -EIO;
} }
@ -665,7 +663,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
else if (long_op == CIFS_BLOCKING_OP) else if (long_op == CIFS_BLOCKING_OP)
timeout = 0x7FFFFFFF; /* large but no so large as to wrap */ timeout = 0x7FFFFFFF; /* large but no so large as to wrap */
else { else {
cERROR(1, ("unknown timeout flag %d", long_op)); cERROR(1, "unknown timeout flag %d", long_op);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -681,8 +679,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
if (midQ->resp_buf == NULL) { if (midQ->resp_buf == NULL) {
cERROR(1, ("No response for cmd %d mid %d", cERROR(1, "No response for cmd %d mid %d",
midQ->command, midQ->mid)); midQ->command, midQ->mid);
if (midQ->midState == MID_REQUEST_SUBMITTED) { if (midQ->midState == MID_REQUEST_SUBMITTED) {
if (ses->server->tcpStatus == CifsExiting) if (ses->server->tcpStatus == CifsExiting)
rc = -EHOSTDOWN; rc = -EHOSTDOWN;
@ -695,7 +693,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
if (rc != -EHOSTDOWN) { if (rc != -EHOSTDOWN) {
if (midQ->midState == MID_RETRY_NEEDED) { if (midQ->midState == MID_RETRY_NEEDED) {
rc = -EAGAIN; rc = -EAGAIN;
cFYI(1, ("marking request for retry")); cFYI(1, "marking request for retry");
} else { } else {
rc = -EIO; rc = -EIO;
} }
@ -712,8 +710,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
receive_len = midQ->resp_buf->smb_buf_length; receive_len = midQ->resp_buf->smb_buf_length;
if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
cERROR(1, ("Frame too large received. Length: %d Xid: %d", cERROR(1, "Frame too large received. Length: %d Xid: %d",
receive_len, xid)); receive_len, xid);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -736,7 +734,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
&ses->server->mac_signing_key, &ses->server->mac_signing_key,
midQ->sequence_number+1); midQ->sequence_number+1);
if (rc) { if (rc) {
cERROR(1, ("Unexpected SMB signature")); cERROR(1, "Unexpected SMB signature");
/* BB FIXME add code to kill session */ /* BB FIXME add code to kill session */
} }
} }
@ -753,7 +751,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
} else { } else {
rc = -EIO; rc = -EIO;
cERROR(1, ("Bad MID state?")); cERROR(1, "Bad MID state?");
} }
out: out:
@ -824,13 +822,13 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
struct cifsSesInfo *ses; struct cifsSesInfo *ses;
if (tcon == NULL || tcon->ses == NULL) { if (tcon == NULL || tcon->ses == NULL) {
cERROR(1, ("Null smb session")); cERROR(1, "Null smb session");
return -EIO; return -EIO;
} }
ses = tcon->ses; ses = tcon->ses;
if (ses->server == NULL) { if (ses->server == NULL) {
cERROR(1, ("Null tcp session")); cERROR(1, "Null tcp session");
return -EIO; return -EIO;
} }
@ -842,8 +840,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
use ses->maxReq */ use ses->maxReq */
if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
cERROR(1, ("Illegal length, greater than maximum frame, %d", cERROR(1, "Illegal length, greater than maximum frame, %d",
in_buf->smb_buf_length)); in_buf->smb_buf_length);
return -EIO; return -EIO;
} }
@ -933,8 +931,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
receive_len = midQ->resp_buf->smb_buf_length; receive_len = midQ->resp_buf->smb_buf_length;
} else { } else {
cERROR(1, ("No response for cmd %d mid %d", cERROR(1, "No response for cmd %d mid %d",
midQ->command, midQ->mid)); midQ->command, midQ->mid);
if (midQ->midState == MID_REQUEST_SUBMITTED) { if (midQ->midState == MID_REQUEST_SUBMITTED) {
if (ses->server->tcpStatus == CifsExiting) if (ses->server->tcpStatus == CifsExiting)
rc = -EHOSTDOWN; rc = -EHOSTDOWN;
@ -947,7 +945,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
if (rc != -EHOSTDOWN) { if (rc != -EHOSTDOWN) {
if (midQ->midState == MID_RETRY_NEEDED) { if (midQ->midState == MID_RETRY_NEEDED) {
rc = -EAGAIN; rc = -EAGAIN;
cFYI(1, ("marking request for retry")); cFYI(1, "marking request for retry");
} else { } else {
rc = -EIO; rc = -EIO;
} }
@ -958,8 +956,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
} }
if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
cERROR(1, ("Frame too large received. Length: %d Xid: %d", cERROR(1, "Frame too large received. Length: %d Xid: %d",
receive_len, xid)); receive_len, xid);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -968,7 +966,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
if ((out_buf == NULL) || (midQ->midState != MID_RESPONSE_RECEIVED)) { if ((out_buf == NULL) || (midQ->midState != MID_RESPONSE_RECEIVED)) {
rc = -EIO; rc = -EIO;
cERROR(1, ("Bad MID state?")); cERROR(1, "Bad MID state?");
goto out; goto out;
} }
@ -986,7 +984,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
&ses->server->mac_signing_key, &ses->server->mac_signing_key,
midQ->sequence_number+1); midQ->sequence_number+1);
if (rc) { if (rc) {
cERROR(1, ("Unexpected SMB signature")); cERROR(1, "Unexpected SMB signature");
/* BB FIXME add code to kill session */ /* BB FIXME add code to kill session */
} }
} }

View file

@ -70,12 +70,12 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
return rc; return rc;
} }
if (ea_name == NULL) { if (ea_name == NULL) {
cFYI(1, ("Null xattr names not supported")); cFYI(1, "Null xattr names not supported");
} else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5)
&& (strncmp(ea_name, CIFS_XATTR_OS2_PREFIX, 4))) { && (strncmp(ea_name, CIFS_XATTR_OS2_PREFIX, 4))) {
cFYI(1, cFYI(1,
("illegal xattr request %s (only user namespace supported)", "illegal xattr request %s (only user namespace supported)",
ea_name)); ea_name);
/* BB what if no namespace prefix? */ /* BB what if no namespace prefix? */
/* Should we just pass them to server, except for /* Should we just pass them to server, except for
system and perhaps security prefixes? */ system and perhaps security prefixes? */
@ -131,19 +131,19 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
search server for EAs or streams to search server for EAs or streams to
returns as xattrs */ returns as xattrs */
if (value_size > MAX_EA_VALUE_SIZE) { if (value_size > MAX_EA_VALUE_SIZE) {
cFYI(1, ("size of EA value too large")); cFYI(1, "size of EA value too large");
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (ea_name == NULL) { if (ea_name == NULL) {
cFYI(1, ("Null xattr names not supported")); cFYI(1, "Null xattr names not supported");
} else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) { } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
goto set_ea_exit; goto set_ea_exit;
if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0)
cFYI(1, ("attempt to set cifs inode metadata")); cFYI(1, "attempt to set cifs inode metadata");
ea_name += 5; /* skip past user. prefix */ ea_name += 5; /* skip past user. prefix */
rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
@ -169,9 +169,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
ACL_TYPE_ACCESS, cifs_sb->local_nls, ACL_TYPE_ACCESS, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("set POSIX ACL rc %d", rc)); cFYI(1, "set POSIX ACL rc %d", rc);
#else #else
cFYI(1, ("set POSIX ACL not supported")); cFYI(1, "set POSIX ACL not supported");
#endif #endif
} else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT, } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
@ -182,13 +182,13 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
ACL_TYPE_DEFAULT, cifs_sb->local_nls, ACL_TYPE_DEFAULT, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("set POSIX default ACL rc %d", rc)); cFYI(1, "set POSIX default ACL rc %d", rc);
#else #else
cFYI(1, ("set default POSIX ACL not supported")); cFYI(1, "set default POSIX ACL not supported");
#endif #endif
} else { } else {
cFYI(1, ("illegal xattr request %s (only user namespace" cFYI(1, "illegal xattr request %s (only user namespace"
" supported)", ea_name)); " supported)", ea_name);
/* BB what if no namespace prefix? */ /* BB what if no namespace prefix? */
/* Should we just pass them to server, except for /* Should we just pass them to server, except for
system and perhaps security prefixes? */ system and perhaps security prefixes? */
@ -235,13 +235,13 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
/* return dos attributes as pseudo xattr */ /* return dos attributes as pseudo xattr */
/* return alt name if available as pseudo attr */ /* return alt name if available as pseudo attr */
if (ea_name == NULL) { if (ea_name == NULL) {
cFYI(1, ("Null xattr names not supported")); cFYI(1, "Null xattr names not supported");
} else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) { } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
goto get_ea_exit; goto get_ea_exit;
if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) { if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) {
cFYI(1, ("attempt to query cifs inode metadata")); cFYI(1, "attempt to query cifs inode metadata");
/* revalidate/getattr then populate from inode */ /* revalidate/getattr then populate from inode */
} /* BB add else when above is implemented */ } /* BB add else when above is implemented */
ea_name += 5; /* skip past user. prefix */ ea_name += 5; /* skip past user. prefix */
@ -287,7 +287,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
} }
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
#else #else
cFYI(1, ("query POSIX ACL not supported yet")); cFYI(1, "query POSIX ACL not supported yet");
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
} else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT, } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
@ -299,18 +299,18 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
#else #else
cFYI(1, ("query POSIX default ACL not supported yet")); cFYI(1, "query POSIX default ACL not supported yet");
#endif #endif
} else if (strncmp(ea_name, } else if (strncmp(ea_name,
CIFS_XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) { CIFS_XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) {
cFYI(1, ("Trusted xattr namespace not supported yet")); cFYI(1, "Trusted xattr namespace not supported yet");
} else if (strncmp(ea_name, } else if (strncmp(ea_name,
CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) { CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) {
cFYI(1, ("Security xattr namespace not supported yet")); cFYI(1, "Security xattr namespace not supported yet");
} else } else
cFYI(1, cFYI(1,
("illegal xattr request %s (only user namespace supported)", "illegal xattr request %s (only user namespace supported)",
ea_name)); ea_name);
/* We could add an additional check for streams ie /* We could add an additional check for streams ie
if proc/fs/cifs/streamstoxattr is set then if proc/fs/cifs/streamstoxattr is set then