aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-07-06 18:44:50 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-06 18:44:50 -0400
commit79a58d1f6075bc0029c38836be9790917a69a342 (patch)
tree88159126918cbe653cac62725237e2e9fd7f4b0c /fs/cifs
parentd20acd09e3bf89aa23af034b8c2d0f5653577ea9 (diff)
[CIFS] whitespace cleanup
checkpatch.pl redux Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smberr.h8
-rw-r--r--fs/cifs/transport.c226
-rw-r--r--fs/cifs/xattr.c226
3 files changed, 232 insertions, 228 deletions
diff --git a/fs/cifs/smberr.h b/fs/cifs/smberr.h
index 212c3c296409..23a7860c6d0c 100644
--- a/fs/cifs/smberr.h
+++ b/fs/cifs/smberr.h
@@ -4,8 +4,8 @@
4 * Copyright (c) International Business Machines Corp., 2002,2004 4 * Copyright (c) International Business Machines Corp., 2002,2004
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * See Error Codes section of the SNIA CIFS Specification 7 * See Error Codes section of the SNIA CIFS Specification
8 * for more information 8 * for more information
9 * 9 *
10 * This library is free software; you can redistribute it and/or modify 10 * This library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published 11 * it under the terms of the GNU Lesser General Public License as published
@@ -19,7 +19,7 @@
19 * 19 *
20 * You should have received a copy of the GNU Lesser General Public License 20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software 21 * along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#define SUCCESS 0x00 /* The request was successful. */ 25#define SUCCESS 0x00 /* The request was successful. */
@@ -110,7 +110,7 @@
110 110
111/* Below errors are used internally (do not come over the wire) for passthrough 111/* Below errors are used internally (do not come over the wire) for passthrough
112 from STATUS codes to POSIX only */ 112 from STATUS codes to POSIX only */
113#define ErrTooManyLinks 0xFFFE 113#define ErrTooManyLinks 0xFFFE
114 114
115/* Following error codes may be generated with the ERRSRV error class.*/ 115/* Following error codes may be generated with the ERRSRV error class.*/
116 116
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 5f468459a1e2..01b589163bd8 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * fs/cifs/transport.c 2 * fs/cifs/transport.c
3 * 3 *
4 * Copyright (C) International Business Machines Corp., 2002,2005 4 * Copyright (C) International Business Machines Corp., 2002,2007
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * Jeremy Allison (jra@samba.org) 2006. 6 * Jeremy Allison (jra@samba.org) 2006.
7 * 7 *
8 * This library is free software; you can redistribute it and/or modify 8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published 9 * it under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation; either version 2.1 of the License, or 10 * by the Free Software Foundation; either version 2.1 of the License, or
@@ -17,7 +17,7 @@
17 * 17 *
18 * You should have received a copy of the GNU Lesser General Public License 18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software 19 * along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <linux/fs.h> 23#include <linux/fs.h>
@@ -86,7 +86,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
86 list_del(&midEntry->qhead); 86 list_del(&midEntry->qhead);
87 atomic_dec(&midCount); 87 atomic_dec(&midCount);
88 spin_unlock(&GlobalMid_Lock); 88 spin_unlock(&GlobalMid_Lock);
89 if(midEntry->largeBuf) 89 if (midEntry->largeBuf)
90 cifs_buf_release(midEntry->resp_buf); 90 cifs_buf_release(midEntry->resp_buf);
91 else 91 else
92 cifs_small_buf_release(midEntry->resp_buf); 92 cifs_small_buf_release(midEntry->resp_buf);
@@ -94,8 +94,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
94 now = jiffies; 94 now = jiffies;
95 /* commands taking longer than one second are indications that 95 /* commands taking longer than one second are indications that
96 something is wrong, unless it is quite a slow link or server */ 96 something is wrong, unless it is quite a slow link or server */
97 if((now - midEntry->when_alloc) > HZ) { 97 if ((now - midEntry->when_alloc) > HZ) {
98 if((cifsFYI & CIFS_TIMER) && 98 if ((cifsFYI & CIFS_TIMER) &&
99 (midEntry->command != SMB_COM_LOCKING_ANDX)) { 99 (midEntry->command != SMB_COM_LOCKING_ANDX)) {
100 printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %d", 100 printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %d",
101 midEntry->command, midEntry->mid); 101 midEntry->command, midEntry->mid);
@@ -110,10 +110,10 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
110} 110}
111 111
112struct oplock_q_entry * 112struct oplock_q_entry *
113AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon) 113AllocOplockQEntry(struct inode *pinode, __u16 fid, struct cifsTconInfo *tcon)
114{ 114{
115 struct oplock_q_entry *temp; 115 struct oplock_q_entry *temp;
116 if ((pinode== NULL) || (tcon == NULL)) { 116 if ((pinode == NULL) || (tcon == NULL)) {
117 cERROR(1, ("Null parms passed to AllocOplockQEntry")); 117 cERROR(1, ("Null parms passed to AllocOplockQEntry"));
118 return NULL; 118 return NULL;
119 } 119 }
@@ -133,9 +133,9 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
133 133
134} 134}
135 135
136void DeleteOplockQEntry(struct oplock_q_entry * oplockEntry) 136void DeleteOplockQEntry(struct oplock_q_entry *oplockEntry)
137{ 137{
138 spin_lock(&GlobalMid_Lock); 138 spin_lock(&GlobalMid_Lock);
139 /* should we check if list empty first? */ 139 /* should we check if list empty first? */
140 list_del(&oplockEntry->qhead); 140 list_del(&oplockEntry->qhead);
141 spin_unlock(&GlobalMid_Lock); 141 spin_unlock(&GlobalMid_Lock);
@@ -152,7 +152,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
152 struct kvec iov; 152 struct kvec iov;
153 unsigned len = smb_buf_length + 4; 153 unsigned len = smb_buf_length + 4;
154 154
155 if(ssocket == NULL) 155 if (ssocket == NULL)
156 return -ENOTSOCK; /* BB eventually add reconnect code here */ 156 return -ENOTSOCK; /* BB eventually add reconnect code here */
157 iov.iov_base = smb_buffer; 157 iov.iov_base = smb_buffer;
158 iov.iov_len = len; 158 iov.iov_len = len;
@@ -164,8 +164,8 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
164 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ 164 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
165 165
166 /* smb header is converted in header_assemble. bcc and rest of SMB word 166 /* smb header is converted in header_assemble. bcc and rest of SMB word
167 area, and byte area if necessary, is converted to littleendian in 167 area, and byte area if necessary, is converted to littleendian in
168 cifssmb.c and RFC1001 len is converted to bigendian in smb_send 168 cifssmb.c and RFC1001 len is converted to bigendian in smb_send
169 Flags2 is converted in SendReceive */ 169 Flags2 is converted in SendReceive */
170 170
171 smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); 171 smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length);
@@ -177,9 +177,9 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
177 if ((rc == -ENOSPC) || (rc == -EAGAIN)) { 177 if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
178 i++; 178 i++;
179 /* smaller timeout here than send2 since smaller size */ 179 /* smaller timeout here than send2 since smaller size */
180 /* Although it may not be required, this also is smaller 180 /* Although it may not be required, this also is smaller
181 oplock break time */ 181 oplock break time */
182 if(i > 12) { 182 if (i > 12) {
183 cERROR(1, 183 cERROR(1,
184 ("sends on sock %p stuck for 7 seconds", 184 ("sends on sock %p stuck for 7 seconds",
185 ssocket)); 185 ssocket));
@@ -189,7 +189,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
189 msleep(1 << i); 189 msleep(1 << i);
190 continue; 190 continue;
191 } 191 }
192 if (rc < 0) 192 if (rc < 0)
193 break; 193 break;
194 else 194 else
195 i = 0; /* reset i after each successful send */ 195 i = 0; /* reset i after each successful send */
@@ -199,7 +199,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
199 } 199 }
200 200
201 if (rc < 0) { 201 if (rc < 0) {
202 cERROR(1,("Error %d sending data on socket to server", rc)); 202 cERROR(1, ("Error %d sending data on socket to server", rc));
203 } else { 203 } else {
204 rc = 0; 204 rc = 0;
205 } 205 }
@@ -224,7 +224,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
224 int first_vec = 0; 224 int first_vec = 0;
225 unsigned int smb_buf_length = smb_buffer->smb_buf_length; 225 unsigned int smb_buf_length = smb_buffer->smb_buf_length;
226 226
227 if(ssocket == NULL) 227 if (ssocket == NULL)
228 return -ENOTSOCK; /* BB eventually add reconnect code here */ 228 return -ENOTSOCK; /* BB eventually add reconnect code here */
229 229
230 smb_msg.msg_name = sin; 230 smb_msg.msg_name = sin;
@@ -234,8 +234,8 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
234 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ 234 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
235 235
236 /* smb header is converted in header_assemble. bcc and rest of SMB word 236 /* smb header is converted in header_assemble. bcc and rest of SMB word
237 area, and byte area if necessary, is converted to littleendian in 237 area, and byte area if necessary, is converted to littleendian in
238 cifssmb.c and RFC1001 len is converted to bigendian in smb_send 238 cifssmb.c and RFC1001 len is converted to bigendian in smb_send
239 Flags2 is converted in SendReceive */ 239 Flags2 is converted in SendReceive */
240 240
241 241
@@ -252,7 +252,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
252 n_vec - first_vec, total_len); 252 n_vec - first_vec, total_len);
253 if ((rc == -ENOSPC) || (rc == -EAGAIN)) { 253 if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
254 i++; 254 i++;
255 if(i >= 14) { 255 if (i >= 14) {
256 cERROR(1, 256 cERROR(1,
257 ("sends on sock %p stuck for 15 seconds", 257 ("sends on sock %p stuck for 15 seconds",
258 ssocket)); 258 ssocket));
@@ -262,17 +262,17 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
262 msleep(1 << i); 262 msleep(1 << i);
263 continue; 263 continue;
264 } 264 }
265 if (rc < 0) 265 if (rc < 0)
266 break; 266 break;
267 267
268 if (rc >= total_len) { 268 if (rc >= total_len) {
269 WARN_ON(rc > total_len); 269 WARN_ON(rc > total_len);
270 break; 270 break;
271 } 271 }
272 if(rc == 0) { 272 if (rc == 0) {
273 /* should never happen, letting socket clear before 273 /* should never happen, letting socket clear before
274 retrying is our only obvious option here */ 274 retrying is our only obvious option here */
275 cERROR(1,("tcp sent no data")); 275 cERROR(1, ("tcp sent no data"));
276 msleep(500); 276 msleep(500);
277 continue; 277 continue;
278 } 278 }
@@ -295,7 +295,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
295 } 295 }
296 296
297 if (rc < 0) { 297 if (rc < 0) {
298 cERROR(1,("Error %d sending data on socket to server", rc)); 298 cERROR(1, ("Error %d sending data on socket to server", rc));
299 } else 299 } else
300 rc = 0; 300 rc = 0;
301 301
@@ -308,13 +308,13 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
308 308
309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) 309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
310{ 310{
311 if(long_op == -1) { 311 if (long_op == -1) {
312 /* oplock breaks must not be held up */ 312 /* oplock breaks must not be held up */
313 atomic_inc(&ses->server->inFlight); 313 atomic_inc(&ses->server->inFlight);
314 } else { 314 } else {
315 spin_lock(&GlobalMid_Lock); 315 spin_lock(&GlobalMid_Lock);
316 while(1) { 316 while (1) {
317 if(atomic_read(&ses->server->inFlight) >= 317 if (atomic_read(&ses->server->inFlight) >=
318 cifs_max_pending){ 318 cifs_max_pending){
319 spin_unlock(&GlobalMid_Lock); 319 spin_unlock(&GlobalMid_Lock);
320#ifdef CONFIG_CIFS_STATS2 320#ifdef CONFIG_CIFS_STATS2
@@ -328,13 +328,13 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
328#endif 328#endif
329 spin_lock(&GlobalMid_Lock); 329 spin_lock(&GlobalMid_Lock);
330 } else { 330 } else {
331 if(ses->server->tcpStatus == CifsExiting) { 331 if (ses->server->tcpStatus == CifsExiting) {
332 spin_unlock(&GlobalMid_Lock); 332 spin_unlock(&GlobalMid_Lock);
333 return -ENOENT; 333 return -ENOENT;
334 } 334 }
335 335
336 /* can not count locking commands against total since 336 /* can not count locking commands against total
337 they are allowed to block on server */ 337 as they are allowed to block on server */
338 338
339 /* update # of requests on the wire to server */ 339 /* update # of requests on the wire to server */
340 if (long_op < 3) 340 if (long_op < 3)
@@ -353,11 +353,11 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
353 if (ses->server->tcpStatus == CifsExiting) { 353 if (ses->server->tcpStatus == CifsExiting) {
354 return -ENOENT; 354 return -ENOENT;
355 } else if (ses->server->tcpStatus == CifsNeedReconnect) { 355 } else if (ses->server->tcpStatus == CifsNeedReconnect) {
356 cFYI(1,("tcp session dead - return to caller to retry")); 356 cFYI(1, ("tcp session dead - return to caller to retry"));
357 return -EAGAIN; 357 return -EAGAIN;
358 } else if (ses->status != CifsGood) { 358 } else if (ses->status != CifsGood) {
359 /* check if SMB session is bad because we are setting it up */ 359 /* check if SMB session is bad because we are setting it up */
360 if((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && 360 if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) &&
361 (in_buf->Command != SMB_COM_NEGOTIATE)) { 361 (in_buf->Command != SMB_COM_NEGOTIATE)) {
362 return -EAGAIN; 362 return -EAGAIN;
363 } /* else ok - we are setting up session */ 363 } /* else ok - we are setting up session */
@@ -369,7 +369,7 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
369 return 0; 369 return 0;
370} 370}
371 371
372static int wait_for_response(struct cifsSesInfo *ses, 372static int wait_for_response(struct cifsSesInfo *ses,
373 struct mid_q_entry *midQ, 373 struct mid_q_entry *midQ,
374 unsigned long timeout, 374 unsigned long timeout,
375 unsigned long time_to_wait) 375 unsigned long time_to_wait)
@@ -379,8 +379,8 @@ static int wait_for_response(struct cifsSesInfo *ses,
379 for (;;) { 379 for (;;) {
380 curr_timeout = timeout + jiffies; 380 curr_timeout = timeout + jiffies;
381 wait_event(ses->server->response_q, 381 wait_event(ses->server->response_q,
382 (!(midQ->midState == MID_REQUEST_SUBMITTED)) || 382 (!(midQ->midState == MID_REQUEST_SUBMITTED)) ||
383 time_after(jiffies, curr_timeout) || 383 time_after(jiffies, curr_timeout) ||
384 ((ses->server->tcpStatus != CifsGood) && 384 ((ses->server->tcpStatus != CifsGood) &&
385 (ses->server->tcpStatus != CifsNew))); 385 (ses->server->tcpStatus != CifsNew)));
386 386
@@ -398,16 +398,16 @@ static int wait_for_response(struct cifsSesInfo *ses,
398 spin_unlock(&GlobalMid_Lock); 398 spin_unlock(&GlobalMid_Lock);
399 399
400 /* Calculate time_to_wait past last receive time. 400 /* Calculate time_to_wait past last receive time.
401 Although we prefer not to time out if the 401 Although we prefer not to time out if the
402 server is still responding - we will time 402 server is still responding - we will time
403 out if the server takes more than 15 (or 45 403 out if the server takes more than 15 (or 45
404 or 180) seconds to respond to this request 404 or 180) seconds to respond to this request
405 and has not responded to any request from 405 and has not responded to any request from
406 other threads on the client within 10 seconds */ 406 other threads on the client within 10 seconds */
407 lrt += time_to_wait; 407 lrt += time_to_wait;
408 if (time_after(jiffies, lrt)) { 408 if (time_after(jiffies, lrt)) {
409 /* No replies for time_to_wait. */ 409 /* No replies for time_to_wait. */
410 cERROR(1,("server not responding")); 410 cERROR(1, ("server not responding"));
411 return -1; 411 return -1;
412 } 412 }
413 } else { 413 } else {
@@ -417,8 +417,8 @@ static int wait_for_response(struct cifsSesInfo *ses,
417} 417}
418 418
419int 419int
420SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 420SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
421 struct kvec *iov, int n_vec, int * pRespBufType /* ret */, 421 struct kvec *iov, int n_vec, int *pRespBufType /* ret */,
422 const int long_op) 422 const int long_op)
423{ 423{
424 int rc = 0; 424 int rc = 0;
@@ -431,16 +431,16 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
431 431
432 if ((ses == NULL) || (ses->server == NULL)) { 432 if ((ses == NULL) || (ses->server == NULL)) {
433 cifs_small_buf_release(in_buf); 433 cifs_small_buf_release(in_buf);
434 cERROR(1,("Null session")); 434 cERROR(1, ("Null session"));
435 return -EIO; 435 return -EIO;
436 } 436 }
437 437
438 if(ses->server->tcpStatus == CifsExiting) { 438 if (ses->server->tcpStatus == CifsExiting) {
439 cifs_small_buf_release(in_buf); 439 cifs_small_buf_release(in_buf);
440 return -ENOENT; 440 return -ENOENT;
441 } 441 }
442 442
443 /* Ensure that we do not send more than 50 overlapping requests 443 /* Ensure that we do not send more than 50 overlapping requests
444 to the same server. We may make this configurable later or 444 to the same server. We may make this configurable later or
445 use ses->maxReq */ 445 use ses->maxReq */
446 446
@@ -450,23 +450,23 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
450 return rc; 450 return rc;
451 } 451 }
452 452
453 /* make sure that we sign in the same order that we send on this socket 453 /* make sure that we sign in the same order that we send on this socket
454 and avoid races inside tcp sendmsg code that could cause corruption 454 and avoid races inside tcp sendmsg code that could cause corruption
455 of smb data */ 455 of smb data */
456 456
457 down(&ses->server->tcpSem); 457 down(&ses->server->tcpSem);
458 458
459 rc = allocate_mid(ses, in_buf, &midQ); 459 rc = allocate_mid(ses, in_buf, &midQ);
460 if (rc) { 460 if (rc) {
461 up(&ses->server->tcpSem); 461 up(&ses->server->tcpSem);
462 cifs_small_buf_release(in_buf); 462 cifs_small_buf_release(in_buf);
463 /* Update # of requests on wire to server */ 463 /* Update # of requests on wire to server */
464 atomic_dec(&ses->server->inFlight); 464 atomic_dec(&ses->server->inFlight);
465 wake_up(&ses->server->request_q); 465 wake_up(&ses->server->request_q);
466 return rc; 466 return rc;
467 } 467 }
468 468
469 rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); 469 rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number);
470 470
471 midQ->midState = MID_REQUEST_SUBMITTED; 471 midQ->midState = MID_REQUEST_SUBMITTED;
472#ifdef CONFIG_CIFS_STATS2 472#ifdef CONFIG_CIFS_STATS2
@@ -482,7 +482,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
482 up(&ses->server->tcpSem); 482 up(&ses->server->tcpSem);
483 cifs_small_buf_release(in_buf); 483 cifs_small_buf_release(in_buf);
484 484
485 if(rc < 0) 485 if (rc < 0)
486 goto out; 486 goto out;
487 487
488 if (long_op == -1) 488 if (long_op == -1)
@@ -490,18 +490,18 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
490 else if (long_op == 2) /* writes past end of file can take loong time */ 490 else if (long_op == 2) /* writes past end of file can take loong time */
491 timeout = 180 * HZ; 491 timeout = 180 * HZ;
492 else if (long_op == 1) 492 else if (long_op == 1)
493 timeout = 45 * HZ; /* should be greater than 493 timeout = 45 * HZ; /* should be greater than
494 servers oplock break timeout (about 43 seconds) */ 494 servers oplock break timeout (about 43 seconds) */
495 else 495 else
496 timeout = 15 * HZ; 496 timeout = 15 * HZ;
497 497
498 /* wait for 15 seconds or until woken up due to response arriving or 498 /* wait for 15 seconds or until woken up due to response arriving or
499 due to last connection to this server being unmounted */ 499 due to last connection to this server being unmounted */
500 if (signal_pending(current)) { 500 if (signal_pending(current)) {
501 /* if signal pending do not hold up user for full smb timeout 501 /* if signal pending do not hold up user for full smb timeout
502 but we still give response a chance to complete */ 502 but we still give response a chance to complete */
503 timeout = 2 * HZ; 503 timeout = 2 * HZ;
504 } 504 }
505 505
506 /* No user interrupts in wait - wreaks havoc with performance */ 506 /* No user interrupts in wait - wreaks havoc with performance */
507 wait_for_response(ses, midQ, timeout, 10 * HZ); 507 wait_for_response(ses, midQ, timeout, 10 * HZ);
@@ -511,10 +511,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
511 spin_unlock(&GlobalMid_Lock); 511 spin_unlock(&GlobalMid_Lock);
512 receive_len = midQ->resp_buf->smb_buf_length; 512 receive_len = midQ->resp_buf->smb_buf_length;
513 } else { 513 } else {
514 cERROR(1,("No response to cmd %d mid %d", 514 cERROR(1, ("No response to cmd %d mid %d",
515 midQ->command, midQ->mid)); 515 midQ->command, midQ->mid));
516 if(midQ->midState == MID_REQUEST_SUBMITTED) { 516 if (midQ->midState == MID_REQUEST_SUBMITTED) {
517 if(ses->server->tcpStatus == CifsExiting) 517 if (ses->server->tcpStatus == CifsExiting)
518 rc = -EHOSTDOWN; 518 rc = -EHOSTDOWN;
519 else { 519 else {
520 ses->server->tcpStatus = CifsNeedReconnect; 520 ses->server->tcpStatus = CifsNeedReconnect;
@@ -523,9 +523,9 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
523 } 523 }
524 524
525 if (rc != -EHOSTDOWN) { 525 if (rc != -EHOSTDOWN) {
526 if(midQ->midState == MID_RETRY_NEEDED) { 526 if (midQ->midState == MID_RETRY_NEEDED) {
527 rc = -EAGAIN; 527 rc = -EAGAIN;
528 cFYI(1,("marking request for retry")); 528 cFYI(1, ("marking request for retry"));
529 } else { 529 } else {
530 rc = -EIO; 530 rc = -EIO;
531 } 531 }
@@ -533,7 +533,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
533 spin_unlock(&GlobalMid_Lock); 533 spin_unlock(&GlobalMid_Lock);
534 DeleteMidQEntry(midQ); 534 DeleteMidQEntry(midQ);
535 /* Update # of requests on wire to server */ 535 /* Update # of requests on wire to server */
536 atomic_dec(&ses->server->inFlight); 536 atomic_dec(&ses->server->inFlight);
537 wake_up(&ses->server->request_q); 537 wake_up(&ses->server->request_q);
538 return rc; 538 return rc;
539 } 539 }
@@ -543,11 +543,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
543 receive_len, xid)); 543 receive_len, xid));
544 rc = -EIO; 544 rc = -EIO;
545 } else { /* rcvd frame is ok */ 545 } else { /* rcvd frame is ok */
546 if (midQ->resp_buf && 546 if (midQ->resp_buf &&
547 (midQ->midState == MID_RESPONSE_RECEIVED)) { 547 (midQ->midState == MID_RESPONSE_RECEIVED)) {
548 548
549 iov[0].iov_base = (char *)midQ->resp_buf; 549 iov[0].iov_base = (char *)midQ->resp_buf;
550 if(midQ->largeBuf) 550 if (midQ->largeBuf)
551 *pRespBufType = CIFS_LARGE_BUFFER; 551 *pRespBufType = CIFS_LARGE_BUFFER;
552 else 552 else
553 *pRespBufType = CIFS_SMALL_BUFFER; 553 *pRespBufType = CIFS_SMALL_BUFFER;
@@ -555,14 +555,14 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
555 555
556 dump_smb(midQ->resp_buf, 80); 556 dump_smb(midQ->resp_buf, 80);
557 /* convert the length into a more usable form */ 557 /* convert the length into a more usable form */
558 if((receive_len > 24) && 558 if ((receive_len > 24) &&
559 (ses->server->secMode & (SECMODE_SIGN_REQUIRED | 559 (ses->server->secMode & (SECMODE_SIGN_REQUIRED |
560 SECMODE_SIGN_ENABLED))) { 560 SECMODE_SIGN_ENABLED))) {
561 rc = cifs_verify_signature(midQ->resp_buf, 561 rc = cifs_verify_signature(midQ->resp_buf,
562 ses->server->mac_signing_key, 562 ses->server->mac_signing_key,
563 midQ->sequence_number+1); 563 midQ->sequence_number+1);
564 if(rc) { 564 if (rc) {
565 cERROR(1,("Unexpected SMB signature")); 565 cERROR(1, ("Unexpected SMB signature"));
566 /* BB FIXME add code to kill session */ 566 /* BB FIXME add code to kill session */
567 } 567 }
568 } 568 }
@@ -576,19 +576,19 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
576 sizeof (struct smb_hdr) - 576 sizeof (struct smb_hdr) -
577 4 /* do not count RFC1001 header */ + 577 4 /* do not count RFC1001 header */ +
578 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) 578 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
579 BCC(midQ->resp_buf) = 579 BCC(midQ->resp_buf) =
580 le16_to_cpu(BCC_LE(midQ->resp_buf)); 580 le16_to_cpu(BCC_LE(midQ->resp_buf));
581 midQ->resp_buf = NULL; /* mark it so will not be freed 581 midQ->resp_buf = NULL; /* mark it so will not be freed
582 by DeleteMidQEntry */ 582 by DeleteMidQEntry */
583 } else { 583 } else {
584 rc = -EIO; 584 rc = -EIO;
585 cFYI(1,("Bad MID state?")); 585 cFYI(1, ("Bad MID state?"));
586 } 586 }
587 } 587 }
588 588
589out: 589out:
590 DeleteMidQEntry(midQ); 590 DeleteMidQEntry(midQ);
591 atomic_dec(&ses->server->inFlight); 591 atomic_dec(&ses->server->inFlight);
592 wake_up(&ses->server->request_q); 592 wake_up(&ses->server->request_q);
593 593
594 return rc; 594 return rc;
@@ -605,18 +605,18 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
605 struct mid_q_entry *midQ; 605 struct mid_q_entry *midQ;
606 606
607 if (ses == NULL) { 607 if (ses == NULL) {
608 cERROR(1,("Null smb session")); 608 cERROR(1, ("Null smb session"));
609 return -EIO; 609 return -EIO;
610 } 610 }
611 if(ses->server == NULL) { 611 if (ses->server == NULL) {
612 cERROR(1,("Null tcp session")); 612 cERROR(1, ("Null tcp session"));
613 return -EIO; 613 return -EIO;
614 } 614 }
615 615
616 if(ses->server->tcpStatus == CifsExiting) 616 if (ses->server->tcpStatus == CifsExiting)
617 return -ENOENT; 617 return -ENOENT;
618 618
619 /* Ensure that we do not send more than 50 overlapping requests 619 /* Ensure that we do not send more than 50 overlapping requests
620 to the same server. We may make this configurable later or 620 to the same server. We may make this configurable later or
621 use ses->maxReq */ 621 use ses->maxReq */
622 622
@@ -624,17 +624,17 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
624 if (rc) 624 if (rc)
625 return rc; 625 return rc;
626 626
627 /* make sure that we sign in the same order that we send on this socket 627 /* make sure that we sign in the same order that we send on this socket
628 and avoid races inside tcp sendmsg code that could cause corruption 628 and avoid races inside tcp sendmsg code that could cause corruption
629 of smb data */ 629 of smb data */
630 630
631 down(&ses->server->tcpSem); 631 down(&ses->server->tcpSem);
632 632
633 rc = allocate_mid(ses, in_buf, &midQ); 633 rc = allocate_mid(ses, in_buf, &midQ);
634 if (rc) { 634 if (rc) {
635 up(&ses->server->tcpSem); 635 up(&ses->server->tcpSem);
636 /* Update # of requests on wire to server */ 636 /* Update # of requests on wire to server */
637 atomic_dec(&ses->server->inFlight); 637 atomic_dec(&ses->server->inFlight);
638 wake_up(&ses->server->request_q); 638 wake_up(&ses->server->request_q);
639 return rc; 639 return rc;
640 } 640 }
@@ -645,7 +645,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
645 DeleteMidQEntry(midQ); 645 DeleteMidQEntry(midQ);
646 up(&ses->server->tcpSem); 646 up(&ses->server->tcpSem);
647 /* Update # of requests on wire to server */ 647 /* Update # of requests on wire to server */
648 atomic_dec(&ses->server->inFlight); 648 atomic_dec(&ses->server->inFlight);
649 wake_up(&ses->server->request_q); 649 wake_up(&ses->server->request_q);
650 return -EIO; 650 return -EIO;
651 } 651 }
@@ -664,7 +664,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
664#endif 664#endif
665 up(&ses->server->tcpSem); 665 up(&ses->server->tcpSem);
666 666
667 if(rc < 0) 667 if (rc < 0)
668 goto out; 668 goto out;
669 669
670 if (long_op == -1) 670 if (long_op == -1)
@@ -672,17 +672,17 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
672 else if (long_op == 2) /* writes past end of file can take loong time */ 672 else if (long_op == 2) /* writes past end of file can take loong time */
673 timeout = 180 * HZ; 673 timeout = 180 * HZ;
674 else if (long_op == 1) 674 else if (long_op == 1)
675 timeout = 45 * HZ; /* should be greater than 675 timeout = 45 * HZ; /* should be greater than
676 servers oplock break timeout (about 43 seconds) */ 676 servers oplock break timeout (about 43 seconds) */
677 else 677 else
678 timeout = 15 * HZ; 678 timeout = 15 * HZ;
679 /* wait for 15 seconds or until woken up due to response arriving or 679 /* wait for 15 seconds or until woken up due to response arriving or
680 due to last connection to this server being unmounted */ 680 due to last connection to this server being unmounted */
681 if (signal_pending(current)) { 681 if (signal_pending(current)) {
682 /* if signal pending do not hold up user for full smb timeout 682 /* if signal pending do not hold up user for full smb timeout
683 but we still give response a chance to complete */ 683 but we still give response a chance to complete */
684 timeout = 2 * HZ; 684 timeout = 2 * HZ;
685 } 685 }
686 686
687 /* No user interrupts in wait - wreaks havoc with performance */ 687 /* No user interrupts in wait - wreaks havoc with performance */
688 wait_for_response(ses, midQ, timeout, 10 * HZ); 688 wait_for_response(ses, midQ, timeout, 10 * HZ);
@@ -692,10 +692,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
692 spin_unlock(&GlobalMid_Lock); 692 spin_unlock(&GlobalMid_Lock);
693 receive_len = midQ->resp_buf->smb_buf_length; 693 receive_len = midQ->resp_buf->smb_buf_length;
694 } else { 694 } else {
695 cERROR(1,("No response for cmd %d mid %d", 695 cERROR(1, ("No response for cmd %d mid %d",
696 midQ->command, midQ->mid)); 696 midQ->command, midQ->mid));
697 if(midQ->midState == MID_REQUEST_SUBMITTED) { 697 if (midQ->midState == MID_REQUEST_SUBMITTED) {
698 if(ses->server->tcpStatus == CifsExiting) 698 if (ses->server->tcpStatus == CifsExiting)
699 rc = -EHOSTDOWN; 699 rc = -EHOSTDOWN;
700 else { 700 else {
701 ses->server->tcpStatus = CifsNeedReconnect; 701 ses->server->tcpStatus = CifsNeedReconnect;
@@ -704,9 +704,9 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
704 } 704 }
705 705
706 if (rc != -EHOSTDOWN) { 706 if (rc != -EHOSTDOWN) {
707 if(midQ->midState == MID_RETRY_NEEDED) { 707 if (midQ->midState == MID_RETRY_NEEDED) {
708 rc = -EAGAIN; 708 rc = -EAGAIN;
709 cFYI(1,("marking request for retry")); 709 cFYI(1, ("marking request for retry"));
710 } else { 710 } else {
711 rc = -EIO; 711 rc = -EIO;
712 } 712 }
@@ -714,7 +714,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
714 spin_unlock(&GlobalMid_Lock); 714 spin_unlock(&GlobalMid_Lock);
715 DeleteMidQEntry(midQ); 715 DeleteMidQEntry(midQ);
716 /* Update # of requests on wire to server */ 716 /* Update # of requests on wire to server */
717 atomic_dec(&ses->server->inFlight); 717 atomic_dec(&ses->server->inFlight);
718 wake_up(&ses->server->request_q); 718 wake_up(&ses->server->request_q);
719 return rc; 719 return rc;
720 } 720 }
@@ -734,14 +734,14 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
734 734
735 dump_smb(out_buf, 92); 735 dump_smb(out_buf, 92);
736 /* convert the length into a more usable form */ 736 /* convert the length into a more usable form */
737 if((receive_len > 24) && 737 if ((receive_len > 24) &&
738 (ses->server->secMode & (SECMODE_SIGN_REQUIRED | 738 (ses->server->secMode & (SECMODE_SIGN_REQUIRED |
739 SECMODE_SIGN_ENABLED))) { 739 SECMODE_SIGN_ENABLED))) {
740 rc = cifs_verify_signature(out_buf, 740 rc = cifs_verify_signature(out_buf,
741 ses->server->mac_signing_key, 741 ses->server->mac_signing_key,
742 midQ->sequence_number+1); 742 midQ->sequence_number+1);
743 if(rc) { 743 if (rc) {
744 cERROR(1,("Unexpected SMB signature")); 744 cERROR(1, ("Unexpected SMB signature"));
745 /* BB FIXME add code to kill session */ 745 /* BB FIXME add code to kill session */
746 } 746 }
747 } 747 }
@@ -759,13 +759,13 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
759 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 759 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
760 } else { 760 } else {
761 rc = -EIO; 761 rc = -EIO;
762 cERROR(1,("Bad MID state?")); 762 cERROR(1, ("Bad MID state?"));
763 } 763 }
764 } 764 }
765 765
766out: 766out:
767 DeleteMidQEntry(midQ); 767 DeleteMidQEntry(midQ);
768 atomic_dec(&ses->server->inFlight); 768 atomic_dec(&ses->server->inFlight);
769 wake_up(&ses->server->request_q); 769 wake_up(&ses->server->request_q);
770 770
771 return rc; 771 return rc;
@@ -783,7 +783,7 @@ send_nt_cancel(struct cifsTconInfo *tcon, struct smb_hdr *in_buf,
783 783
784 header_assemble(in_buf, SMB_COM_NT_CANCEL, tcon, 0); 784 header_assemble(in_buf, SMB_COM_NT_CANCEL, tcon, 0);
785 in_buf->Mid = mid; 785 in_buf->Mid = mid;
786 down(&ses->server->tcpSem); 786 down(&ses->server->tcpSem);
787 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); 787 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number);
788 if (rc) { 788 if (rc) {
789 up(&ses->server->tcpSem); 789 up(&ses->server->tcpSem);
@@ -832,20 +832,20 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
832 struct cifsSesInfo *ses; 832 struct cifsSesInfo *ses;
833 833
834 if (tcon == NULL || tcon->ses == NULL) { 834 if (tcon == NULL || tcon->ses == NULL) {
835 cERROR(1,("Null smb session")); 835 cERROR(1, ("Null smb session"));
836 return -EIO; 836 return -EIO;
837 } 837 }
838 ses = tcon->ses; 838 ses = tcon->ses;
839 839
840 if(ses->server == NULL) { 840 if (ses->server == NULL) {
841 cERROR(1,("Null tcp session")); 841 cERROR(1, ("Null tcp session"));
842 return -EIO; 842 return -EIO;
843 } 843 }
844 844
845 if(ses->server->tcpStatus == CifsExiting) 845 if (ses->server->tcpStatus == CifsExiting)
846 return -ENOENT; 846 return -ENOENT;
847 847
848 /* Ensure that we do not send more than 50 overlapping requests 848 /* Ensure that we do not send more than 50 overlapping requests
849 to the same server. We may make this configurable later or 849 to the same server. We may make this configurable later or
850 use ses->maxReq */ 850 use ses->maxReq */
851 851
@@ -853,11 +853,11 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
853 if (rc) 853 if (rc)
854 return rc; 854 return rc;
855 855
856 /* make sure that we sign in the same order that we send on this socket 856 /* make sure that we sign in the same order that we send on this socket
857 and avoid races inside tcp sendmsg code that could cause corruption 857 and avoid races inside tcp sendmsg code that could cause corruption
858 of smb data */ 858 of smb data */
859 859
860 down(&ses->server->tcpSem); 860 down(&ses->server->tcpSem);
861 861
862 rc = allocate_mid(ses, in_buf, &midQ); 862 rc = allocate_mid(ses, in_buf, &midQ);
863 if (rc) { 863 if (rc) {
@@ -887,14 +887,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
887#endif 887#endif
888 up(&ses->server->tcpSem); 888 up(&ses->server->tcpSem);
889 889
890 if(rc < 0) { 890 if (rc < 0) {
891 DeleteMidQEntry(midQ); 891 DeleteMidQEntry(midQ);
892 return rc; 892 return rc;
893 } 893 }
894 894
895 /* Wait for a reply - allow signals to interrupt. */ 895 /* Wait for a reply - allow signals to interrupt. */
896 rc = wait_event_interruptible(ses->server->response_q, 896 rc = wait_event_interruptible(ses->server->response_q,
897 (!(midQ->midState == MID_REQUEST_SUBMITTED)) || 897 (!(midQ->midState == MID_REQUEST_SUBMITTED)) ||
898 ((ses->server->tcpStatus != CifsGood) && 898 ((ses->server->tcpStatus != CifsGood) &&
899 (ses->server->tcpStatus != CifsNew))); 899 (ses->server->tcpStatus != CifsNew)));
900 900
@@ -928,7 +928,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
928 } 928 }
929 929
930 /* Wait 5 seconds for the response. */ 930 /* Wait 5 seconds for the response. */
931 if (wait_for_response(ses, midQ, 5 * HZ, 5 * HZ)==0) { 931 if (wait_for_response(ses, midQ, 5 * HZ, 5 * HZ) == 0) {
932 /* We got the response - restart system call. */ 932 /* We got the response - restart system call. */
933 rstart = 1; 933 rstart = 1;
934 } 934 }
@@ -939,10 +939,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
939 spin_unlock(&GlobalMid_Lock); 939 spin_unlock(&GlobalMid_Lock);
940 receive_len = midQ->resp_buf->smb_buf_length; 940 receive_len = midQ->resp_buf->smb_buf_length;
941 } else { 941 } else {
942 cERROR(1,("No response for cmd %d mid %d", 942 cERROR(1, ("No response for cmd %d mid %d",
943 midQ->command, midQ->mid)); 943 midQ->command, midQ->mid));
944 if(midQ->midState == MID_REQUEST_SUBMITTED) { 944 if (midQ->midState == MID_REQUEST_SUBMITTED) {
945 if(ses->server->tcpStatus == CifsExiting) 945 if (ses->server->tcpStatus == CifsExiting)
946 rc = -EHOSTDOWN; 946 rc = -EHOSTDOWN;
947 else { 947 else {
948 ses->server->tcpStatus = CifsNeedReconnect; 948 ses->server->tcpStatus = CifsNeedReconnect;
@@ -951,9 +951,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
951 } 951 }
952 952
953 if (rc != -EHOSTDOWN) { 953 if (rc != -EHOSTDOWN) {
954 if(midQ->midState == MID_RETRY_NEEDED) { 954 if (midQ->midState == MID_RETRY_NEEDED) {
955 rc = -EAGAIN; 955 rc = -EAGAIN;
956 cFYI(1,("marking request for retry")); 956 cFYI(1, ("marking request for retry"));
957 } else { 957 } else {
958 rc = -EIO; 958 rc = -EIO;
959 } 959 }
@@ -978,14 +978,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
978 978
979 dump_smb(out_buf, 92); 979 dump_smb(out_buf, 92);
980 /* convert the length into a more usable form */ 980 /* convert the length into a more usable form */
981 if((receive_len > 24) && 981 if ((receive_len > 24) &&
982 (ses->server->secMode & (SECMODE_SIGN_REQUIRED | 982 (ses->server->secMode & (SECMODE_SIGN_REQUIRED |
983 SECMODE_SIGN_ENABLED))) { 983 SECMODE_SIGN_ENABLED))) {
984 rc = cifs_verify_signature(out_buf, 984 rc = cifs_verify_signature(out_buf,
985 ses->server->mac_signing_key, 985 ses->server->mac_signing_key,
986 midQ->sequence_number+1); 986 midQ->sequence_number+1);
987 if(rc) { 987 if (rc) {
988 cERROR(1,("Unexpected SMB signature")); 988 cERROR(1, ("Unexpected SMB signature"));
989 /* BB FIXME add code to kill session */ 989 /* BB FIXME add code to kill session */
990 } 990 }
991 } 991 }
@@ -1003,7 +1003,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
1003 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 1003 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
1004 } else { 1004 } else {
1005 rc = -EIO; 1005 rc = -EIO;
1006 cERROR(1,("Bad MID state?")); 1006 cERROR(1, ("Bad MID state?"));
1007 } 1007 }
1008 } 1008 }
1009 DeleteMidQEntry(midQ); 1009 DeleteMidQEntry(midQ);
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 18fcec190f8b..5c4cf2926849 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/xattr.c 2 * fs/cifs/xattr.c
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2003 4 * Copyright (c) International Business Machines Corp., 2003, 2007
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -40,47 +40,49 @@
40 40
41 41
42 42
43int cifs_removexattr(struct dentry * direntry, const char * ea_name) 43int cifs_removexattr(struct dentry *direntry, const char *ea_name)
44{ 44{
45 int rc = -EOPNOTSUPP; 45 int rc = -EOPNOTSUPP;
46#ifdef CONFIG_CIFS_XATTR 46#ifdef CONFIG_CIFS_XATTR
47 int xid; 47 int xid;
48 struct cifs_sb_info *cifs_sb; 48 struct cifs_sb_info *cifs_sb;
49 struct cifsTconInfo *pTcon; 49 struct cifsTconInfo *pTcon;
50 struct super_block * sb; 50 struct super_block *sb;
51 char * full_path; 51 char *full_path;
52 52
53 if(direntry == NULL) 53 if (direntry == NULL)
54 return -EIO; 54 return -EIO;
55 if(direntry->d_inode == NULL) 55 if (direntry->d_inode == NULL)
56 return -EIO; 56 return -EIO;
57 sb = direntry->d_inode->i_sb; 57 sb = direntry->d_inode->i_sb;
58 if(sb == NULL) 58 if (sb == NULL)
59 return -EIO; 59 return -EIO;
60 xid = GetXid(); 60 xid = GetXid();
61 61
62 cifs_sb = CIFS_SB(sb); 62 cifs_sb = CIFS_SB(sb);
63 pTcon = cifs_sb->tcon; 63 pTcon = cifs_sb->tcon;
64 64
65 full_path = build_path_from_dentry(direntry); 65 full_path = build_path_from_dentry(direntry);
66 if(full_path == NULL) { 66 if (full_path == NULL) {
67 FreeXid(xid); 67 FreeXid(xid);
68 return -ENOMEM; 68 return -ENOMEM;
69 } 69 }
70 if(ea_name == NULL) { 70 if (ea_name == NULL) {
71 cFYI(1,("Null xattr names not supported")); 71 cFYI(1, ("Null xattr names not supported"));
72 } else if(strncmp(ea_name,CIFS_XATTR_USER_PREFIX,5) 72 } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5)
73 && (strncmp(ea_name,CIFS_XATTR_OS2_PREFIX,4))) { 73 && (strncmp(ea_name, CIFS_XATTR_OS2_PREFIX, 4))) {
74 cFYI(1,("illegal xattr namespace %s (only user namespace supported)",ea_name)); 74 cFYI(1,
75 ("illegal xattr request %s (only user namespace supported)",
76 ea_name));
75 /* BB what if no namespace prefix? */ 77 /* BB what if no namespace prefix? */
76 /* Should we just pass them to server, except for 78 /* Should we just pass them to server, except for
77 system and perhaps security prefixes? */ 79 system and perhaps security prefixes? */
78 } else { 80 } else {
79 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 81 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
80 goto remove_ea_exit; 82 goto remove_ea_exit;
81 83
82 ea_name+=5; /* skip past user. prefix */ 84 ea_name += 5; /* skip past user. prefix */
83 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,NULL, 85 rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, NULL,
84 (__u16)0, cifs_sb->local_nls, 86 (__u16)0, cifs_sb->local_nls,
85 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
86 } 88 }
@@ -91,23 +93,23 @@ remove_ea_exit:
91 return rc; 93 return rc;
92} 94}
93 95
94int cifs_setxattr(struct dentry * direntry, const char * ea_name, 96int cifs_setxattr(struct dentry *direntry, const char *ea_name,
95 const void * ea_value, size_t value_size, int flags) 97 const void *ea_value, size_t value_size, int flags)
96{ 98{
97 int rc = -EOPNOTSUPP; 99 int rc = -EOPNOTSUPP;
98#ifdef CONFIG_CIFS_XATTR 100#ifdef CONFIG_CIFS_XATTR
99 int xid; 101 int xid;
100 struct cifs_sb_info *cifs_sb; 102 struct cifs_sb_info *cifs_sb;
101 struct cifsTconInfo *pTcon; 103 struct cifsTconInfo *pTcon;
102 struct super_block * sb; 104 struct super_block *sb;
103 char * full_path; 105 char *full_path;
104 106
105 if(direntry == NULL) 107 if (direntry == NULL)
106 return -EIO; 108 return -EIO;
107 if(direntry->d_inode == NULL) 109 if (direntry->d_inode == NULL)
108 return -EIO; 110 return -EIO;
109 sb = direntry->d_inode->i_sb; 111 sb = direntry->d_inode->i_sb;
110 if(sb == NULL) 112 if (sb == NULL)
111 return -EIO; 113 return -EIO;
112 xid = GetXid(); 114 xid = GetXid();
113 115
@@ -115,7 +117,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
115 pTcon = cifs_sb->tcon; 117 pTcon = cifs_sb->tcon;
116 118
117 full_path = build_path_from_dentry(direntry); 119 full_path = build_path_from_dentry(direntry);
118 if(full_path == NULL) { 120 if (full_path == NULL) {
119 FreeXid(xid); 121 FreeXid(xid);
120 return -ENOMEM; 122 return -ENOMEM;
121 } 123 }
@@ -123,67 +125,68 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
123 /* return alt name if available as pseudo attr */ 125 /* return alt name if available as pseudo attr */
124 126
125 /* if proc/fs/cifs/streamstoxattr is set then 127 /* if proc/fs/cifs/streamstoxattr is set then
126 search server for EAs or streams to 128 search server for EAs or streams to
127 returns as xattrs */ 129 returns as xattrs */
128 if(value_size > MAX_EA_VALUE_SIZE) { 130 if (value_size > MAX_EA_VALUE_SIZE) {
129 cFYI(1,("size of EA value too large")); 131 cFYI(1, ("size of EA value too large"));
130 kfree(full_path); 132 kfree(full_path);
131 FreeXid(xid); 133 FreeXid(xid);
132 return -EOPNOTSUPP; 134 return -EOPNOTSUPP;
133 } 135 }
134 136
135 if(ea_name == NULL) { 137 if (ea_name == NULL) {
136 cFYI(1,("Null xattr names not supported")); 138 cFYI(1, ("Null xattr names not supported"));
137 } else if(strncmp(ea_name,CIFS_XATTR_USER_PREFIX,5) == 0) { 139 } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) {
138 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 140 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
139 goto set_ea_exit; 141 goto set_ea_exit;
140 if(strncmp(ea_name,CIFS_XATTR_DOS_ATTRIB,14) == 0) { 142 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) {
141 cFYI(1,("attempt to set cifs inode metadata")); 143 cFYI(1, ("attempt to set cifs inode metadata"));
142 } 144 }
143 ea_name += 5; /* skip past user. prefix */ 145 ea_name += 5; /* skip past user. prefix */
144 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value, 146 rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
145 (__u16)value_size, cifs_sb->local_nls, 147 (__u16)value_size, cifs_sb->local_nls,
146 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 148 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
147 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) { 149 } else if (strncmp(ea_name, CIFS_XATTR_OS2_PREFIX, 4) == 0) {
148 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 150 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
149 goto set_ea_exit; 151 goto set_ea_exit;
150 152
151 ea_name += 4; /* skip past os2. prefix */ 153 ea_name += 4; /* skip past os2. prefix */
152 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value, 154 rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
153 (__u16)value_size, cifs_sb->local_nls, 155 (__u16)value_size, cifs_sb->local_nls,
154 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 156 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
155 } else { 157 } else {
156 int temp; 158 int temp;
157 temp = strncmp(ea_name,POSIX_ACL_XATTR_ACCESS, 159 temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
158 strlen(POSIX_ACL_XATTR_ACCESS)); 160 strlen(POSIX_ACL_XATTR_ACCESS));
159 if (temp == 0) { 161 if (temp == 0) {
160#ifdef CONFIG_CIFS_POSIX 162#ifdef CONFIG_CIFS_POSIX
161 if(sb->s_flags & MS_POSIXACL) 163 if (sb->s_flags & MS_POSIXACL)
162 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path, 164 rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
163 ea_value, (const int)value_size, 165 ea_value, (const int)value_size,
164 ACL_TYPE_ACCESS,cifs_sb->local_nls, 166 ACL_TYPE_ACCESS, cifs_sb->local_nls,
165 cifs_sb->mnt_cifs_flags & 167 cifs_sb->mnt_cifs_flags &
166 CIFS_MOUNT_MAP_SPECIAL_CHR); 168 CIFS_MOUNT_MAP_SPECIAL_CHR);
167 cFYI(1,("set POSIX ACL rc %d",rc)); 169 cFYI(1, ("set POSIX ACL rc %d", rc));
168#else 170#else
169 cFYI(1,("set POSIX ACL not supported")); 171 cFYI(1, ("set POSIX ACL not supported"));
170#endif 172#endif
171 } else if(strncmp(ea_name,POSIX_ACL_XATTR_DEFAULT,strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { 173 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
174 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
172#ifdef CONFIG_CIFS_POSIX 175#ifdef CONFIG_CIFS_POSIX
173 if(sb->s_flags & MS_POSIXACL) 176 if (sb->s_flags & MS_POSIXACL)
174 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path, 177 rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
175 ea_value, (const int)value_size, 178 ea_value, (const int)value_size,
176 ACL_TYPE_DEFAULT, cifs_sb->local_nls, 179 ACL_TYPE_DEFAULT, cifs_sb->local_nls,
177 cifs_sb->mnt_cifs_flags & 180 cifs_sb->mnt_cifs_flags &
178 CIFS_MOUNT_MAP_SPECIAL_CHR); 181 CIFS_MOUNT_MAP_SPECIAL_CHR);
179 cFYI(1,("set POSIX default ACL rc %d",rc)); 182 cFYI(1, ("set POSIX default ACL rc %d", rc));
180#else 183#else
181 cFYI(1,("set default POSIX ACL not supported")); 184 cFYI(1, ("set default POSIX ACL not supported"));
182#endif 185#endif
183 } else { 186 } else {
184 cFYI(1,("illegal xattr request %s (only user namespace supported)",ea_name)); 187 cFYI(1, ("illegal xattr request %s (only user namespace supported)", ea_name));
185 /* BB what if no namespace prefix? */ 188 /* BB what if no namespace prefix? */
186 /* Should we just pass them to server, except for 189 /* Should we just pass them to server, except for
187 system and perhaps security prefixes? */ 190 system and perhaps security prefixes? */
188 } 191 }
189 } 192 }
@@ -195,23 +198,23 @@ set_ea_exit:
195 return rc; 198 return rc;
196} 199}
197 200
198ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name, 201ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
199 void * ea_value, size_t buf_size) 202 void *ea_value, size_t buf_size)
200{ 203{
201 ssize_t rc = -EOPNOTSUPP; 204 ssize_t rc = -EOPNOTSUPP;
202#ifdef CONFIG_CIFS_XATTR 205#ifdef CONFIG_CIFS_XATTR
203 int xid; 206 int xid;
204 struct cifs_sb_info *cifs_sb; 207 struct cifs_sb_info *cifs_sb;
205 struct cifsTconInfo *pTcon; 208 struct cifsTconInfo *pTcon;
206 struct super_block * sb; 209 struct super_block *sb;
207 char * full_path; 210 char *full_path;
208 211
209 if(direntry == NULL) 212 if (direntry == NULL)
210 return -EIO; 213 return -EIO;
211 if(direntry->d_inode == NULL) 214 if (direntry->d_inode == NULL)
212 return -EIO; 215 return -EIO;
213 sb = direntry->d_inode->i_sb; 216 sb = direntry->d_inode->i_sb;
214 if(sb == NULL) 217 if (sb == NULL)
215 return -EIO; 218 return -EIO;
216 219
217 xid = GetXid(); 220 xid = GetXid();
@@ -220,42 +223,42 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
220 pTcon = cifs_sb->tcon; 223 pTcon = cifs_sb->tcon;
221 224
222 full_path = build_path_from_dentry(direntry); 225 full_path = build_path_from_dentry(direntry);
223 if(full_path == NULL) { 226 if (full_path == NULL) {
224 FreeXid(xid); 227 FreeXid(xid);
225 return -ENOMEM; 228 return -ENOMEM;
226 } 229 }
227 /* return dos attributes as pseudo xattr */ 230 /* return dos attributes as pseudo xattr */
228 /* return alt name if available as pseudo attr */ 231 /* return alt name if available as pseudo attr */
229 if(ea_name == NULL) { 232 if (ea_name == NULL) {
230 cFYI(1,("Null xattr names not supported")); 233 cFYI(1, ("Null xattr names not supported"));
231 } else if(strncmp(ea_name,CIFS_XATTR_USER_PREFIX,5) == 0) { 234 } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) {
232 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 235 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
233 goto get_ea_exit; 236 goto get_ea_exit;
234 237
235 if(strncmp(ea_name,CIFS_XATTR_DOS_ATTRIB,14) == 0) { 238 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) {
236 cFYI(1,("attempt to query cifs inode metadata")); 239 cFYI(1, ("attempt to query cifs inode metadata"));
237 /* revalidate/getattr then populate from inode */ 240 /* revalidate/getattr then populate from inode */
238 } /* BB add else when above is implemented */ 241 } /* BB add else when above is implemented */
239 ea_name += 5; /* skip past user. prefix */ 242 ea_name += 5; /* skip past user. prefix */
240 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value, 243 rc = CIFSSMBQueryEA(xid, pTcon, full_path, ea_name, ea_value,
241 buf_size, cifs_sb->local_nls, 244 buf_size, cifs_sb->local_nls,
242 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 245 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
243 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) { 246 } else if (strncmp(ea_name, CIFS_XATTR_OS2_PREFIX, 4) == 0) {
244 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 247 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
245 goto get_ea_exit; 248 goto get_ea_exit;
246 249
247 ea_name += 4; /* skip past os2. prefix */ 250 ea_name += 4; /* skip past os2. prefix */
248 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value, 251 rc = CIFSSMBQueryEA(xid, pTcon, full_path, ea_name, ea_value,
249 buf_size, cifs_sb->local_nls, 252 buf_size, cifs_sb->local_nls,
250 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 253 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
251 } else if(strncmp(ea_name,POSIX_ACL_XATTR_ACCESS, 254 } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
252 strlen(POSIX_ACL_XATTR_ACCESS)) == 0) { 255 strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
253#ifdef CONFIG_CIFS_POSIX 256#ifdef CONFIG_CIFS_POSIX
254 if(sb->s_flags & MS_POSIXACL) 257 if (sb->s_flags & MS_POSIXACL)
255 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, 258 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
256 ea_value, buf_size, ACL_TYPE_ACCESS, 259 ea_value, buf_size, ACL_TYPE_ACCESS,
257 cifs_sb->local_nls, 260 cifs_sb->local_nls,
258 cifs_sb->mnt_cifs_flags & 261 cifs_sb->mnt_cifs_flags &
259 CIFS_MOUNT_MAP_SPECIAL_CHR); 262 CIFS_MOUNT_MAP_SPECIAL_CHR);
260/* else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { 263/* else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
261 __u16 fid; 264 __u16 fid;
@@ -272,39 +275,40 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
272 CIFSSMBClose(xid, pTcon, fid); 275 CIFSSMBClose(xid, pTcon, fid);
273 } 276 }
274 } */ /* BB enable after fixing up return data */ 277 } */ /* BB enable after fixing up return data */
275 278#else
276#else 279 cFYI(1, ("query POSIX ACL not supported yet"));
277 cFYI(1,("query POSIX ACL not supported yet"));
278#endif /* CONFIG_CIFS_POSIX */ 280#endif /* CONFIG_CIFS_POSIX */
279 } else if(strncmp(ea_name,POSIX_ACL_XATTR_DEFAULT, 281 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
280 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { 282 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
281#ifdef CONFIG_CIFS_POSIX 283#ifdef CONFIG_CIFS_POSIX
282 if(sb->s_flags & MS_POSIXACL) 284 if (sb->s_flags & MS_POSIXACL)
283 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, 285 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
284 ea_value, buf_size, ACL_TYPE_DEFAULT, 286 ea_value, buf_size, ACL_TYPE_DEFAULT,
285 cifs_sb->local_nls, 287 cifs_sb->local_nls,
286 cifs_sb->mnt_cifs_flags & 288 cifs_sb->mnt_cifs_flags &
287 CIFS_MOUNT_MAP_SPECIAL_CHR); 289 CIFS_MOUNT_MAP_SPECIAL_CHR);
288#else 290#else
289 cFYI(1,("query POSIX default ACL not supported yet")); 291 cFYI(1, ("query POSIX default ACL not supported yet"));
290#endif 292#endif
291 } else if(strncmp(ea_name, 293 } else if (strncmp(ea_name,
292 CIFS_XATTR_TRUSTED_PREFIX,XATTR_TRUSTED_PREFIX_LEN) == 0) { 294 CIFS_XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) {
293 cFYI(1,("Trusted xattr namespace not supported yet")); 295 cFYI(1, ("Trusted xattr namespace not supported yet"));
294 } else if(strncmp(ea_name, 296 } else if (strncmp(ea_name,
295 CIFS_XATTR_SECURITY_PREFIX,XATTR_SECURITY_PREFIX_LEN) == 0) { 297 CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) {
296 cFYI(1,("Security xattr namespace not supported yet")); 298 cFYI(1, ("Security xattr namespace not supported yet"));
297 } else { 299 } else {
298 cFYI(1,("illegal xattr name request %s (only user namespace supported)",ea_name)); 300 cFYI(1,
301 ("illegal xattr request %s (only user namespace supported)",
302 ea_name));
299 } 303 }
300 304
301 /* We could add an additional check for streams ie 305 /* We could add an additional check for streams ie
302 if proc/fs/cifs/streamstoxattr is set then 306 if proc/fs/cifs/streamstoxattr is set then
303 search server for EAs or streams to 307 search server for EAs or streams to
304 returns as xattrs */ 308 returns as xattrs */
305 309
306 if(rc == -EINVAL) 310 if (rc == -EINVAL)
307 rc = -EOPNOTSUPP; 311 rc = -EOPNOTSUPP;
308 312
309get_ea_exit: 313get_ea_exit:
310 kfree(full_path); 314 kfree(full_path);
@@ -313,34 +317,34 @@ get_ea_exit:
313 return rc; 317 return rc;
314} 318}
315 319
316ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size) 320ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
317{ 321{
318 ssize_t rc = -EOPNOTSUPP; 322 ssize_t rc = -EOPNOTSUPP;
319#ifdef CONFIG_CIFS_XATTR 323#ifdef CONFIG_CIFS_XATTR
320 int xid; 324 int xid;
321 struct cifs_sb_info *cifs_sb; 325 struct cifs_sb_info *cifs_sb;
322 struct cifsTconInfo *pTcon; 326 struct cifsTconInfo *pTcon;
323 struct super_block * sb; 327 struct super_block *sb;
324 char * full_path; 328 char *full_path;
325 329
326 if(direntry == NULL) 330 if (direntry == NULL)
327 return -EIO; 331 return -EIO;
328 if(direntry->d_inode == NULL) 332 if (direntry->d_inode == NULL)
329 return -EIO; 333 return -EIO;
330 sb = direntry->d_inode->i_sb; 334 sb = direntry->d_inode->i_sb;
331 if(sb == NULL) 335 if (sb == NULL)
332 return -EIO; 336 return -EIO;
333 337
334 cifs_sb = CIFS_SB(sb); 338 cifs_sb = CIFS_SB(sb);
335 pTcon = cifs_sb->tcon; 339 pTcon = cifs_sb->tcon;
336 340
337 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 341 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
338 return -EOPNOTSUPP; 342 return -EOPNOTSUPP;
339 343
340 xid = GetXid(); 344 xid = GetXid();
341 345
342 full_path = build_path_from_dentry(direntry); 346 full_path = build_path_from_dentry(direntry);
343 if(full_path == NULL) { 347 if (full_path == NULL) {
344 FreeXid(xid); 348 FreeXid(xid);
345 return -ENOMEM; 349 return -ENOMEM;
346 } 350 }
@@ -348,11 +352,11 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
348 /* return alt name if available as pseudo attr */ 352 /* return alt name if available as pseudo attr */
349 353
350 /* if proc/fs/cifs/streamstoxattr is set then 354 /* if proc/fs/cifs/streamstoxattr is set then
351 search server for EAs or streams to 355 search server for EAs or streams to
352 returns as xattrs */ 356 returns as xattrs */
353 rc = CIFSSMBQAllEAs(xid,pTcon,full_path,data,buf_size, 357 rc = CIFSSMBQAllEAs(xid, pTcon, full_path, data, buf_size,
354 cifs_sb->local_nls, 358 cifs_sb->local_nls,
355 cifs_sb->mnt_cifs_flags & 359 cifs_sb->mnt_cifs_flags &
356 CIFS_MOUNT_MAP_SPECIAL_CHR); 360 CIFS_MOUNT_MAP_SPECIAL_CHR);
357 361
358 kfree(full_path); 362 kfree(full_path);