*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/obdclass/llog.c
*
int rc = 0;
if (refcount_dec_and_test(&loghandle->lgh_refcount)) {
- struct llog_operations *lop;
+ const struct llog_operations *lop;
rc = llog_handle2ops(loghandle, &lop);
if (!rc) {
struct llog_handle *handle,
struct thandle *th)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
int llog_trans_destroy(const struct lu_env *env, struct llog_handle *handle,
struct thandle *th)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
int llog_destroy(const struct lu_env *env, struct llog_handle *handle)
{
- struct llog_operations *lop;
- struct dt_device *dt;
- struct thandle *th;
+ const struct llog_operations *lop;
+ struct dt_device *dt;
+ struct thandle *th;
int rc;
ENTRY;
}
out_unlock:
+ if (rc < 0) {
+ /* restore bitmap while holding a mutex */
+ if (subtract_count) {
+ loghandle->lgh_hdr->llh_count += num;
+ subtract_count = false;
+ }
+ for (i = i - 1; i >= 0; i--)
+ set_bit_le(index[i], LLOG_HDR_BITMAP(llh));
+ }
mutex_unlock(&loghandle->lgh_hdr_mutex);
up_write(&loghandle->lgh_lock);
out_trans:
rc1 = dt_trans_stop(env, dt, th);
if (rc == 0)
rc = rc1;
- if (rc < 0) {
+ if (rc1 < 0) {
mutex_lock(&loghandle->lgh_hdr_mutex);
if (subtract_count)
loghandle->lgh_hdr->llh_count += num;
int llog_read_header(const struct lu_env *env, struct llog_handle *handle,
const struct obd_uuid *uuid)
{
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
CDEBUG(D_OTHER, "cur_offset %llu, chunk_offset %llu,"
" buf_offset %u, rc = %d\n", cur_offset,
(__u64)chunk_offset, buf_offset, rc);
+ if (rc == -ESTALE)
+ GOTO(out, rc = 0);
/* we`ve tried to reread the chunk, but there is no
* new records */
if (rc == -EIO && repeated && (chunk_offset + buf_offset) ==
rc = llog_cancel_rec(lpi->lpi_env,
loghandle,
rec->lrh_index);
+ /* Allow parallel cancelling, ENOENT
+ * means record was canceled at another
+ * processing thread or callback
+ */
+ if (rc == -ENOENT)
+ rc = 0;
}
if (rc)
GOTO(out, rc);
*/
int llog_exist(struct llog_handle *loghandle)
{
- struct llog_operations *lop;
- int rc;
+ const struct llog_operations *lop;
+ int rc;
ENTRY;
struct llog_handle *loghandle, struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc;
ENTRY;
int idx, struct thandle *th)
{
const struct cred *old_cred;
- struct llog_operations *lop;
+ const struct llog_operations *lop;
int rc, buflen;
ENTRY;