~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/target/target_core_pr.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Upstream Kernel Changes
  • Date: 2012-03-27 17:01:30 UTC
  • Revision ID: package-import@ubuntu.com-20120327170130-qrvi60snnxty6ibi
Tags: 3.2.0-1411.14
[ Paolo Pisati ]

* Revert to Ubuntu-3.2.0-1409.12 until we figure out what's wrong with hdmi
  - LP: #963512

[ Upstream Kernel Changes ]

* Revert "Reapply upleveled PMU interrupt patch"
* KBuild: Allow scripts/* to be cross compiled
* LINARO: Use KBUILD_SCRIPTROOT to cross build scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
                                        struct se_node_acl *, struct se_session *);
121
121
static void core_scsi3_put_pr_reg(struct t10_pr_registration *);
122
122
 
123
 
static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd)
 
123
static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd, int *ret)
124
124
{
125
125
        struct se_session *se_sess = cmd->se_sess;
126
126
        struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev;
130
130
        int conflict = 0;
131
131
 
132
132
        if (!crh)
133
 
                return -EINVAL;
 
133
                return false;
134
134
 
135
135
        pr_reg = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl,
136
136
                        se_sess);
158
158
                 */
159
159
                if (pr_reg->pr_res_holder) {
160
160
                        core_scsi3_put_pr_reg(pr_reg);
161
 
                        return 1;
 
161
                        *ret = 0;
 
162
                        return false;
162
163
                }
163
164
                if ((pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_REGONLY) ||
164
165
                    (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_REGONLY) ||
165
166
                    (pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) ||
166
167
                    (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) {
167
168
                        core_scsi3_put_pr_reg(pr_reg);
168
 
                        return 1;
 
169
                        *ret = 0;
 
170
                        return true;
169
171
                }
170
172
                core_scsi3_put_pr_reg(pr_reg);
171
173
                conflict = 1;
190
192
                        " while active SPC-3 registrations exist,"
191
193
                        " returning RESERVATION_CONFLICT\n");
192
194
                cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
193
 
                return -EBUSY;
 
195
                return true;
194
196
        }
195
197
 
196
 
        return 0;
 
198
        return false;
197
199
}
198
200
 
199
201
int target_scsi2_reservation_release(struct se_task *task)
202
204
        struct se_device *dev = cmd->se_dev;
203
205
        struct se_session *sess = cmd->se_sess;
204
206
        struct se_portal_group *tpg = sess->se_tpg;
205
 
        int ret = 0, rc;
 
207
        int ret = 0;
206
208
 
207
209
        if (!sess || !tpg)
208
210
                goto out;
209
 
        rc = target_check_scsi2_reservation_conflict(cmd);
210
 
        if (rc == 1)
211
 
                goto out;
212
 
        else if (rc < 0) {
213
 
                cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
214
 
                ret = -EINVAL;
215
 
                goto out;
216
 
        }
 
211
        if (target_check_scsi2_reservation_conflict(cmd, &ret))
 
212
                goto out;
217
213
 
218
214
        ret = 0;
219
215
        spin_lock(&dev->dev_reservation_lock);
250
246
        struct se_device *dev = cmd->se_dev;
251
247
        struct se_session *sess = cmd->se_sess;
252
248
        struct se_portal_group *tpg = sess->se_tpg;
253
 
        int ret = 0, rc;
 
249
        int ret = 0;
254
250
 
255
251
        if ((cmd->t_task_cdb[1] & 0x01) &&
256
252
            (cmd->t_task_cdb[1] & 0x02)) {
266
262
         */
267
263
        if (!sess || !tpg)
268
264
                goto out;
269
 
        rc = target_check_scsi2_reservation_conflict(cmd);
270
 
        if (rc == 1)
271
 
                goto out;
272
 
        else if (rc < 0) {
273
 
                cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
274
 
                ret = -EINVAL;
275
 
                goto out;
276
 
        }
 
265
        if (target_check_scsi2_reservation_conflict(cmd, &ret))
 
266
                goto out;
277
267
 
278
268
        ret = 0;
279
269
        spin_lock(&dev->dev_reservation_lock);