~ssalley/ubuntu/maverick/likewise-open/likewise-open.fix627272

« back to all changes in this revision

Viewing changes to lwio/server/pvfs/sharemode.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerald Carter, Michael Casadevall, Gerald Carter
  • Date: 2010-03-13 07:42:44 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100313074244-j1gy0zo19cc32xhl
Tags: 5.4.0.42111-1
[ Michael Casadevall ]
* LP: #517300
  - added debian/patches/disable_parallel_builds.diff to allow successful builds
    on non-x86 architectures caused by improperly parsing /proc/cpuinfo to
    determine the number of CPUs and set make -jX.
  - added debian/patches/correct_lwio_configure_detection.diff to correct configure
    tests for properly checking proc filesystems on non-x86 linux platforms
  - added ${misc:Depends} to Depends lines to satisfy lintian
  - Added debian/README.source to satisfy lintian 
  - Bumped standards version to 3.8.3

[ Gerald Carter ]
* New upstream release. (LP: #538616)
* likewise-open.install: Include uninstalled binaries and ncalrpc
    servers required for domainjoin-cli {join,leave}
* patches/version-in-share.diff:
  - Corrected location of VERSION file in lsassd

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    ntError = PvfsFindFCB(&pFcb, pszFilename);
69
69
    if (ntError == STATUS_SUCCESS) {
70
70
 
71
 
        ntError = PvfsEnforceShareMode(pFcb,
72
 
                                       SharedAccess,
73
 
                                       DesiredAccess);
74
 
        BAIL_ON_NT_STATUS(ntError);
75
 
 
76
 
        *ppFcb = pFcb;
77
 
 
 
71
        ntError = PvfsEnforceShareMode(
 
72
                      pFcb,
 
73
                      SharedAccess,
 
74
                      DesiredAccess);
 
75
 
 
76
        /* If we have success, then we are good.  If we have a sharing
 
77
           violation, give the caller a chance to break the oplock and
 
78
           we'll try again when the create is resumed. */
 
79
 
 
80
        if (ntError == STATUS_SUCCESS ||
 
81
            ntError == STATUS_SHARING_VIOLATION)
 
82
        {
 
83
            *ppFcb = PvfsReferenceFCB(pFcb);
 
84
        }
78
85
        goto cleanup;
79
86
    }
80
87
 
81
 
    if (ntError != STATUS_OBJECT_NAME_NOT_FOUND) {
 
88
    if (ntError != STATUS_OBJECT_NAME_NOT_FOUND)
 
89
    {
82
90
        BAIL_ON_NT_STATUS(ntError);
83
91
    }
84
92
 
85
93
    /* If not found, then add one */
86
94
 
87
 
    ntError = PvfsCreateFCB(&pFcb, pszFilename,
88
 
                            SharedAccess, DesiredAccess);
 
95
    ntError = PvfsCreateFCB(
 
96
                  &pFcb,
 
97
                  pszFilename,
 
98
                  SharedAccess,
 
99
                  DesiredAccess);
89
100
    BAIL_ON_NT_STATUS(ntError);
90
101
 
91
 
    *ppFcb = pFcb;
 
102
    *ppFcb = PvfsReferenceFCB(pFcb);
92
103
    ntError = STATUS_SUCCESS;
93
104
 
94
105
cleanup:
95
 
    return ntError;
96
 
 
97
 
error:
98
106
    if (pFcb) {
99
 
        PvfsReleaseFCB(pFcb);
 
107
        PvfsReleaseFCB(&pFcb);
100
108
    }
101
109
 
 
110
    return ntError;
 
111
 
 
112
error:
102
113
    goto cleanup;
103
114
}
104
115
 
122
133
{
123
134
    NTSTATUS ntError = STATUS_UNSUCCESSFUL;
124
135
    int i = 0;
125
 
    ULONG RetryMax = 4;
 
136
    ULONG RetryMax = 3;
126
137
    struct timespec SleepTime = {0};
127
138
    struct timespec RemainingTime = {0};
128
139
 
129
 
    for (i=0; i<RetryMax; i++)
 
140
    for (i=0; i<RetryMax && (ntError != STATUS_SUCCESS); i++)
130
141
    {
131
142
        ntError = _PvfsEnforceShareMode(pFcb, ShareAccess, DesiredAccess);
132
143
        if ((ntError == STATUS_SHARING_VIOLATION) && (i<(RetryMax-1)))
133
144
        {
 
145
            NTSTATUS ntErrorSleep = STATUS_SUCCESS;
 
146
 
134
147
            /* 2 milliseconds */
135
148
            RemainingTime.tv_sec = 0;
136
149
            RemainingTime.tv_nsec = 2 * 1000000;
139
152
                SleepTime.tv_sec = RemainingTime.tv_sec;
140
153
                SleepTime.tv_nsec = RemainingTime.tv_nsec;
141
154
 
142
 
                ntError = PvfsSysNanoSleep(&SleepTime, &RemainingTime);
143
 
            } while (ntError == STATUS_MORE_PROCESSING_REQUIRED);
 
155
                ntErrorSleep = PvfsSysNanoSleep(&SleepTime, &RemainingTime);
 
156
            } while (ntErrorSleep == STATUS_MORE_PROCESSING_REQUIRED);
144
157
 
145
 
            ntError = STATUS_SUCCESS;
 
158
            continue;
146
159
        }
147
160
        BAIL_ON_NT_STATUS(ntError);
148
 
 
149
 
        /* All done */
150
 
        break;
151
161
    }
152
162
 
153
163
cleanup:
224
234
               an existing share mode */
225
235
 
226
236
            if ((DesiredAccess & ShareModeTable[i].Access) &&
227
 
                !(pCcb->ShareFlags & ShareModeTable[i].ShareFlag))
 
237
                (!(pCcb->ShareFlags & ShareModeTable[i].ShareFlag)))
228
238
            {
229
239
                ntError = STATUS_SHARING_VIOLATION;
230
240
                BAIL_ON_NT_STATUS(ntError);
234
244
               and an existing granted access mask */
235
245
 
236
246
            if ((pCcb->AccessGranted & ShareModeTable[i].Access) &&
237
 
                !(ShareAccess & ShareModeTable[i].ShareFlag))
 
247
                (!(ShareAccess & ShareModeTable[i].ShareFlag)))
238
248
            {
239
249
                ntError = STATUS_SHARING_VIOLATION;
240
250
                BAIL_ON_NT_STATUS(ntError);