aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-08-15 11:36:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-15 11:36:30 -0400
commitaa2b1cf5ca44811ab842c1cd8d32f95b8f51e557 (patch)
tree751ef6ea7dc70317260e95ac0d5bdf795418e12e /fs
parent259a53407d9ae0c109902669c6f2f88a389dd163 (diff)
parente22906c564c2f9c73ee4621ef3b93fe374539f00 (diff)
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: cifs: Do not set cifs/ntfs acl using a file handle (try #4) [CIFS] Cleanup use of CONFIG_CIFS_STATS2 ifdef to make transport routines more readable
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifs_debug.c2
-rw-r--r--fs/cifs/cifsacl.c28
-rw-r--r--fs/cifs/cifsglob.h56
-rw-r--r--fs/cifs/transport.c51
4 files changed, 68 insertions, 69 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 2fe3cf13b2e9..6d40656e1e29 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -176,7 +176,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
176 176
177#ifdef CONFIG_CIFS_STATS2 177#ifdef CONFIG_CIFS_STATS2
178 seq_printf(m, " In Send: %d In MaxReq Wait: %d", 178 seq_printf(m, " In Send: %d In MaxReq Wait: %d",
179 atomic_read(&server->inSend), 179 atomic_read(&server->in_send),
180 atomic_read(&server->num_waiters)); 180 atomic_read(&server->num_waiters));
181#endif 181#endif
182 182
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 21de1d6d5849..d0f59faefb78 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -991,24 +991,6 @@ struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
991 return pntsd; 991 return pntsd;
992} 992}
993 993
994static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
995 struct cifs_ntsd *pnntsd, u32 acllen)
996{
997 int xid, rc;
998 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
999
1000 if (IS_ERR(tlink))
1001 return PTR_ERR(tlink);
1002
1003 xid = GetXid();
1004 rc = CIFSSMBSetCIFSACL(xid, tlink_tcon(tlink), fid, pnntsd, acllen);
1005 FreeXid(xid);
1006 cifs_put_tlink(tlink);
1007
1008 cFYI(DBG2, "SetCIFSACL rc = %d", rc);
1009 return rc;
1010}
1011
1012static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path, 994static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
1013 struct cifs_ntsd *pnntsd, u32 acllen) 995 struct cifs_ntsd *pnntsd, u32 acllen)
1014{ 996{
@@ -1047,18 +1029,10 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
1047 struct inode *inode, const char *path) 1029 struct inode *inode, const char *path)
1048{ 1030{
1049 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1031 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1050 struct cifsFileInfo *open_file;
1051 int rc;
1052 1032
1053 cFYI(DBG2, "set ACL for %s from mode 0x%x", path, inode->i_mode); 1033 cFYI(DBG2, "set ACL for %s from mode 0x%x", path, inode->i_mode);
1054 1034
1055 open_file = find_readable_file(CIFS_I(inode), true); 1035 return set_cifs_acl_by_path(cifs_sb, path, pnntsd, acllen);
1056 if (!open_file)
1057 return set_cifs_acl_by_path(cifs_sb, path, pnntsd, acllen);
1058
1059 rc = set_cifs_acl_by_fid(cifs_sb, open_file->netfid, pnntsd, acllen);
1060 cifsFileInfo_put(open_file);
1061 return rc;
1062} 1036}
1063 1037
1064/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ 1038/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 38ce6d44b145..95dad9d14cf1 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -291,7 +291,7 @@ struct TCP_Server_Info {
291 struct fscache_cookie *fscache; /* client index cache cookie */ 291 struct fscache_cookie *fscache; /* client index cache cookie */
292#endif 292#endif
293#ifdef CONFIG_CIFS_STATS2 293#ifdef CONFIG_CIFS_STATS2
294 atomic_t inSend; /* requests trying to send */ 294 atomic_t in_send; /* requests trying to send */
295 atomic_t num_waiters; /* blocked waiting to get in sendrecv */ 295 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
296#endif 296#endif
297}; 297};
@@ -672,12 +672,54 @@ struct mid_q_entry {
672 bool multiEnd:1; /* both received */ 672 bool multiEnd:1; /* both received */
673}; 673};
674 674
675struct oplock_q_entry { 675/* Make code in transport.c a little cleaner by moving
676 struct list_head qhead; 676 update of optional stats into function below */
677 struct inode *pinode; 677#ifdef CONFIG_CIFS_STATS2
678 struct cifs_tcon *tcon; 678
679 __u16 netfid; 679static inline void cifs_in_send_inc(struct TCP_Server_Info *server)
680}; 680{
681 atomic_inc(&server->in_send);
682}
683
684static inline void cifs_in_send_dec(struct TCP_Server_Info *server)
685{
686 atomic_dec(&server->in_send);
687}
688
689static inline void cifs_num_waiters_inc(struct TCP_Server_Info *server)
690{
691 atomic_inc(&server->num_waiters);
692}
693
694static inline void cifs_num_waiters_dec(struct TCP_Server_Info *server)
695{
696 atomic_dec(&server->num_waiters);
697}
698
699static inline void cifs_save_when_sent(struct mid_q_entry *mid)
700{
701 mid->when_sent = jiffies;
702}
703#else
704static inline void cifs_in_send_inc(struct TCP_Server_Info *server)
705{
706}
707static inline void cifs_in_send_dec(struct TCP_Server_Info *server)
708{
709}
710
711static inline void cifs_num_waiters_inc(struct TCP_Server_Info *server)
712{
713}
714
715static inline void cifs_num_waiters_dec(struct TCP_Server_Info *server)
716{
717}
718
719static inline void cifs_save_when_sent(struct mid_q_entry *mid)
720{
721}
722#endif
681 723
682/* for pending dnotify requests */ 724/* for pending dnotify requests */
683struct dir_notify_req { 725struct dir_notify_req {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index c1b9c4b10739..10ca6b2c26b7 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -266,15 +266,11 @@ static int wait_for_free_request(struct TCP_Server_Info *server,
266 while (1) { 266 while (1) {
267 if (atomic_read(&server->inFlight) >= cifs_max_pending) { 267 if (atomic_read(&server->inFlight) >= cifs_max_pending) {
268 spin_unlock(&GlobalMid_Lock); 268 spin_unlock(&GlobalMid_Lock);
269#ifdef CONFIG_CIFS_STATS2 269 cifs_num_waiters_inc(server);
270 atomic_inc(&server->num_waiters);
271#endif
272 wait_event(server->request_q, 270 wait_event(server->request_q,
273 atomic_read(&server->inFlight) 271 atomic_read(&server->inFlight)
274 < cifs_max_pending); 272 < cifs_max_pending);
275#ifdef CONFIG_CIFS_STATS2 273 cifs_num_waiters_dec(server);
276 atomic_dec(&server->num_waiters);
277#endif
278 spin_lock(&GlobalMid_Lock); 274 spin_lock(&GlobalMid_Lock);
279 } else { 275 } else {
280 if (server->tcpStatus == CifsExiting) { 276 if (server->tcpStatus == CifsExiting) {
@@ -381,15 +377,13 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
381 mid->callback = callback; 377 mid->callback = callback;
382 mid->callback_data = cbdata; 378 mid->callback_data = cbdata;
383 mid->midState = MID_REQUEST_SUBMITTED; 379 mid->midState = MID_REQUEST_SUBMITTED;
384#ifdef CONFIG_CIFS_STATS2 380
385 atomic_inc(&server->inSend); 381 cifs_in_send_inc(server);
386#endif
387 rc = smb_sendv(server, iov, nvec); 382 rc = smb_sendv(server, iov, nvec);
388#ifdef CONFIG_CIFS_STATS2 383 cifs_in_send_dec(server);
389 atomic_dec(&server->inSend); 384 cifs_save_when_sent(mid);
390 mid->when_sent = jiffies;
391#endif
392 mutex_unlock(&server->srv_mutex); 385 mutex_unlock(&server->srv_mutex);
386
393 if (rc) 387 if (rc)
394 goto out_err; 388 goto out_err;
395 389
@@ -575,14 +569,10 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
575 } 569 }
576 570
577 midQ->midState = MID_REQUEST_SUBMITTED; 571 midQ->midState = MID_REQUEST_SUBMITTED;
578#ifdef CONFIG_CIFS_STATS2 572 cifs_in_send_inc(ses->server);
579 atomic_inc(&ses->server->inSend);
580#endif
581 rc = smb_sendv(ses->server, iov, n_vec); 573 rc = smb_sendv(ses->server, iov, n_vec);
582#ifdef CONFIG_CIFS_STATS2 574 cifs_in_send_dec(ses->server);
583 atomic_dec(&ses->server->inSend); 575 cifs_save_when_sent(midQ);
584 midQ->when_sent = jiffies;
585#endif
586 576
587 mutex_unlock(&ses->server->srv_mutex); 577 mutex_unlock(&ses->server->srv_mutex);
588 578
@@ -703,14 +693,11 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
703 } 693 }
704 694
705 midQ->midState = MID_REQUEST_SUBMITTED; 695 midQ->midState = MID_REQUEST_SUBMITTED;
706#ifdef CONFIG_CIFS_STATS2 696
707 atomic_inc(&ses->server->inSend); 697 cifs_in_send_inc(ses->server);
708#endif
709 rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); 698 rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
710#ifdef CONFIG_CIFS_STATS2 699 cifs_in_send_dec(ses->server);
711 atomic_dec(&ses->server->inSend); 700 cifs_save_when_sent(midQ);
712 midQ->when_sent = jiffies;
713#endif
714 mutex_unlock(&ses->server->srv_mutex); 701 mutex_unlock(&ses->server->srv_mutex);
715 702
716 if (rc < 0) 703 if (rc < 0)
@@ -843,14 +830,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
843 } 830 }
844 831
845 midQ->midState = MID_REQUEST_SUBMITTED; 832 midQ->midState = MID_REQUEST_SUBMITTED;
846#ifdef CONFIG_CIFS_STATS2 833 cifs_in_send_inc(ses->server);
847 atomic_inc(&ses->server->inSend);
848#endif
849 rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); 834 rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
850#ifdef CONFIG_CIFS_STATS2 835 cifs_in_send_dec(ses->server);
851 atomic_dec(&ses->server->inSend); 836 cifs_save_when_sent(midQ);
852 midQ->when_sent = jiffies;
853#endif
854 mutex_unlock(&ses->server->srv_mutex); 837 mutex_unlock(&ses->server->srv_mutex);
855 838
856 if (rc < 0) { 839 if (rc < 0) {