~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/modules/onefs_cbrl.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
#include "includes.h"
 
22
#include "smbd/smbd.h"
22
23
#include "onefs.h"
23
24
 
24
25
#include <ifs/ifs_syscalls.h>
28
29
#undef DBGC_CLASS
29
30
#define DBGC_CLASS DBGC_LOCKING
30
31
 
31
 
extern struct blocking_lock_record *blocking_lock_queue;
32
 
 
33
32
static uint64_t onefs_get_new_id(void) {
34
33
        static uint64_t id = 0;
35
34
 
84
83
 
85
84
static void onefs_cbrl_enumerate_blq(const char *fn)
86
85
{
 
86
        struct smbd_server_connection *sconn = smbd_server_conn;
87
87
        struct blocking_lock_record *blr;
88
88
 
89
89
        if (DEBUGLVL(10))
91
91
 
92
92
        DEBUG(10, ("CBRL BLR records (%s):\n", fn));
93
93
 
94
 
        for (blr = blocking_lock_queue; blr; blr = blr->next)
95
 
                DEBUGADD(10, ("%s\n", onefs_cbrl_blr_state_str(blr)));
 
94
        if (sconn->using_smb2) {
 
95
                struct smbd_smb2_request *smb2req;
 
96
                for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) {
 
97
                        blr = get_pending_smb2req_blr(smb2req);
 
98
                        if (blr) {
 
99
                                DEBUGADD(10, ("%s\n", onefs_cbrl_blr_state_str(blr)));
 
100
                        }
 
101
                }
 
102
        } else {
 
103
                for (blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = blr->next)
 
104
                        DEBUGADD(10, ("%s\n", onefs_cbrl_blr_state_str(blr)));
 
105
        }
96
106
}
97
107
 
98
108
static struct blocking_lock_record *onefs_cbrl_find_blr(uint64_t id)
99
109
{
 
110
        struct smbd_server_connection *sconn = smbd_server_conn;
100
111
        struct blocking_lock_record *blr;
101
112
        struct onefs_cbrl_blr_state *bs;
102
113
 
103
114
        onefs_cbrl_enumerate_blq("onefs_cbrl_find_blr");
104
115
 
105
 
        for (blr = blocking_lock_queue; blr; blr = blr->next) {
106
 
                bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
107
 
 
108
 
                /* We don't control all of the BLRs on the BLQ. */
109
 
                if (bs == NULL)
110
 
                        continue;
111
 
 
112
 
                if (bs->id == id) {
113
 
                        DEBUG(10, ("found %s\n",
114
 
                            onefs_cbrl_blr_state_str(blr)));
115
 
                        break;
 
116
        if (sconn->using_smb2) {
 
117
                struct smbd_smb2_request *smb2req;
 
118
                for (smb2req = sconn->smb2.requests; smb2req; smb2req = nextreq) {
 
119
                        blr = get_pending_smb2req_blr(smb2req);
 
120
                        if (!blr) {
 
121
                                continue;
 
122
                        }
 
123
                        bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
 
124
                        if (bs == NULL) {
 
125
                                continue;
 
126
                        }
 
127
                        if (bs->id == id) {
 
128
                                DEBUG(10, ("found %s\n",
 
129
                                    onefs_cbrl_blr_state_str(blr)));
 
130
                                break;
 
131
                        }
 
132
                }
 
133
        } else {
 
134
                for (blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = blr->next) {
 
135
                        bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
 
136
 
 
137
                        /* We don't control all of the BLRs on the BLQ. */
 
138
                        if (bs == NULL)
 
139
                                continue;
 
140
 
 
141
                        if (bs->id == id) {
 
142
                                DEBUG(10, ("found %s\n",
 
143
                                    onefs_cbrl_blr_state_str(blr)));
 
144
                                break;
 
145
                        }
116
146
                }
117
147
        }
118
148
 
156
186
            LEVEL2_CONTEND_WINDOWS_BRL);
157
187
 
158
188
        /* Process the queue, to try the next lock or finish up. */
159
 
        process_blocking_lock_queue();
 
189
        process_blocking_lock_queue(smbd_server_conn);
160
190
}
161
191
 
162
192
static void onefs_cbrl_async_failure(uint64_t id)
179
209
 
180
210
        /* Process the queue. It will end up trying to retake the same lock,
181
211
         * see the error in onefs_cbrl_lock_windows() and fail. */
182
 
        process_blocking_lock_queue();
 
212
        process_blocking_lock_queue(smbd_server_conn);
183
213
}
184
214
 
185
215
static struct cbrl_event_ops cbrl_ops =