Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Linus Torvalds committed Aug 15, 2011
2 parents 259a534 + e22906c commit aa2b1cf
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 69 deletions.
2 changes: 1 addition & 1 deletion fs/cifs/cifs_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)

#ifdef CONFIG_CIFS_STATS2
seq_printf(m, " In Send: %d In MaxReq Wait: %d",
atomic_read(&server->inSend),
atomic_read(&server->in_send),
atomic_read(&server->num_waiters));
#endif

Expand Down
28 changes: 1 addition & 27 deletions fs/cifs/cifsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,24 +991,6 @@ struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
return pntsd;
}

static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
struct cifs_ntsd *pnntsd, u32 acllen)
{
int xid, rc;
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);

if (IS_ERR(tlink))
return PTR_ERR(tlink);

xid = GetXid();
rc = CIFSSMBSetCIFSACL(xid, tlink_tcon(tlink), fid, pnntsd, acllen);
FreeXid(xid);
cifs_put_tlink(tlink);

cFYI(DBG2, "SetCIFSACL rc = %d", rc);
return rc;
}

static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
struct cifs_ntsd *pnntsd, u32 acllen)
{
Expand Down Expand Up @@ -1047,18 +1029,10 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
struct inode *inode, const char *path)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsFileInfo *open_file;
int rc;

cFYI(DBG2, "set ACL for %s from mode 0x%x", path, inode->i_mode);

open_file = find_readable_file(CIFS_I(inode), true);
if (!open_file)
return set_cifs_acl_by_path(cifs_sb, path, pnntsd, acllen);

rc = set_cifs_acl_by_fid(cifs_sb, open_file->netfid, pnntsd, acllen);
cifsFileInfo_put(open_file);
return rc;
return set_cifs_acl_by_path(cifs_sb, path, pnntsd, acllen);
}

/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
Expand Down
56 changes: 49 additions & 7 deletions fs/cifs/cifsglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ struct TCP_Server_Info {
struct fscache_cookie *fscache; /* client index cache cookie */
#endif
#ifdef CONFIG_CIFS_STATS2
atomic_t inSend; /* requests trying to send */
atomic_t in_send; /* requests trying to send */
atomic_t num_waiters; /* blocked waiting to get in sendrecv */
#endif
};
Expand Down Expand Up @@ -672,12 +672,54 @@ struct mid_q_entry {
bool multiEnd:1; /* both received */
};

struct oplock_q_entry {
struct list_head qhead;
struct inode *pinode;
struct cifs_tcon *tcon;
__u16 netfid;
};
/* Make code in transport.c a little cleaner by moving
update of optional stats into function below */
#ifdef CONFIG_CIFS_STATS2

static inline void cifs_in_send_inc(struct TCP_Server_Info *server)
{
atomic_inc(&server->in_send);
}

static inline void cifs_in_send_dec(struct TCP_Server_Info *server)
{
atomic_dec(&server->in_send);
}

static inline void cifs_num_waiters_inc(struct TCP_Server_Info *server)
{
atomic_inc(&server->num_waiters);
}

static inline void cifs_num_waiters_dec(struct TCP_Server_Info *server)
{
atomic_dec(&server->num_waiters);
}

static inline void cifs_save_when_sent(struct mid_q_entry *mid)
{
mid->when_sent = jiffies;
}
#else
static inline void cifs_in_send_inc(struct TCP_Server_Info *server)
{
}
static inline void cifs_in_send_dec(struct TCP_Server_Info *server)
{
}

static inline void cifs_num_waiters_inc(struct TCP_Server_Info *server)
{
}

static inline void cifs_num_waiters_dec(struct TCP_Server_Info *server)
{
}

static inline void cifs_save_when_sent(struct mid_q_entry *mid)
{
}
#endif

/* for pending dnotify requests */
struct dir_notify_req {
Expand Down
51 changes: 17 additions & 34 deletions fs/cifs/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,11 @@ static int wait_for_free_request(struct TCP_Server_Info *server,
while (1) {
if (atomic_read(&server->inFlight) >= cifs_max_pending) {
spin_unlock(&GlobalMid_Lock);
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&server->num_waiters);
#endif
cifs_num_waiters_inc(server);
wait_event(server->request_q,
atomic_read(&server->inFlight)
< cifs_max_pending);
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&server->num_waiters);
#endif
cifs_num_waiters_dec(server);
spin_lock(&GlobalMid_Lock);
} else {
if (server->tcpStatus == CifsExiting) {
Expand Down Expand Up @@ -381,15 +377,13 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
mid->callback = callback;
mid->callback_data = cbdata;
mid->midState = MID_REQUEST_SUBMITTED;
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&server->inSend);
#endif

cifs_in_send_inc(server);
rc = smb_sendv(server, iov, nvec);
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&server->inSend);
mid->when_sent = jiffies;
#endif
cifs_in_send_dec(server);
cifs_save_when_sent(mid);
mutex_unlock(&server->srv_mutex);

if (rc)
goto out_err;

Expand Down Expand Up @@ -575,14 +569,10 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
}

midQ->midState = MID_REQUEST_SUBMITTED;
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&ses->server->inSend);
#endif
cifs_in_send_inc(ses->server);
rc = smb_sendv(ses->server, iov, n_vec);
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&ses->server->inSend);
midQ->when_sent = jiffies;
#endif
cifs_in_send_dec(ses->server);
cifs_save_when_sent(midQ);

mutex_unlock(&ses->server->srv_mutex);

Expand Down Expand Up @@ -703,14 +693,11 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
}

midQ->midState = MID_REQUEST_SUBMITTED;
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&ses->server->inSend);
#endif

cifs_in_send_inc(ses->server);
rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&ses->server->inSend);
midQ->when_sent = jiffies;
#endif
cifs_in_send_dec(ses->server);
cifs_save_when_sent(midQ);
mutex_unlock(&ses->server->srv_mutex);

if (rc < 0)
Expand Down Expand Up @@ -843,14 +830,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
}

midQ->midState = MID_REQUEST_SUBMITTED;
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&ses->server->inSend);
#endif
cifs_in_send_inc(ses->server);
rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&ses->server->inSend);
midQ->when_sent = jiffies;
#endif
cifs_in_send_dec(ses->server);
cifs_save_when_sent(midQ);
mutex_unlock(&ses->server->srv_mutex);

if (rc < 0) {
Expand Down

0 comments on commit aa2b1cf

Please sign in to comment.