Skip to content

Commit

Permalink
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/aegl/linux-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] define "_sdata" symbol
  pstore: Fix Kconfig dependencies for apei->pstore
  pstore: fix potential logic issue in pstore read interface
  pstore: fix pstore filesystem mount/remount issue
  pstore: fix one type of return value in pstore
  [IA64] fix build warning in arch/ia64/oprofile/backtrace.c
  • Loading branch information
torvalds committed May 20, 2011
2 parents 102dc1b + 30f7276 commit 8e7bfcb
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 21 deletions.
1 change: 1 addition & 0 deletions arch/ia64/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ SECTIONS {
data : {
} :data
.data : AT(ADDR(.data) - LOAD_OFFSET) {
_sdata = .;
INIT_TASK_DATA(PAGE_SIZE)
CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
READ_MOSTLY_DATA(SMP_CACHE_BYTES)
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct
unsigned int depth;
struct pt_regs *regs;
struct unw_frame_info frame;
u64 *prev_pfs_loc; /* state for WAR for old spinlock ool code */
unsigned long *prev_pfs_loc; /* state for WAR for old spinlock ool code */
} ia64_backtrace_t;

/* Returns non-zero if the PC is in the Interrupt Vector Table */
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/apei/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config ACPI_APEI
bool "ACPI Platform Error Interface (APEI)"
select MISC_FILESYSTEMS
select PSTORE
depends on X86
help
Expand Down
61 changes: 45 additions & 16 deletions drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,17 @@ static int erst_check_table(struct acpi_table_erst *erst_tab)
return 0;
}

static size_t erst_reader(u64 *id, enum pstore_type_id *type,
static int erst_open_pstore(struct pstore_info *psi);
static int erst_close_pstore(struct pstore_info *psi);
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
struct timespec *time);
static u64 erst_writer(enum pstore_type_id type, size_t size);

static struct pstore_info erst_info = {
.owner = THIS_MODULE,
.name = "erst",
.open = erst_open_pstore,
.close = erst_close_pstore,
.read = erst_reader,
.write = erst_writer,
.erase = erst_clear
Expand All @@ -957,37 +961,61 @@ struct cper_pstore_record {
char data[];
} __packed;

static size_t erst_reader(u64 *id, enum pstore_type_id *type,
static int reader_pos;

static int erst_open_pstore(struct pstore_info *psi)
{
int rc;

if (erst_disable)
return -ENODEV;

rc = erst_get_record_id_begin(&reader_pos);

return rc;
}

static int erst_close_pstore(struct pstore_info *psi)
{
erst_get_record_id_end();

return 0;
}

static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
struct timespec *time)
{
int rc;
ssize_t len;
unsigned long flags;
ssize_t len = 0;
u64 record_id;
struct cper_pstore_record *rcd = (struct cper_pstore_record *)
(erst_info.buf - sizeof(*rcd));

if (erst_disable)
return -ENODEV;

raw_spin_lock_irqsave(&erst_lock, flags);
skip:
rc = __erst_get_next_record_id(&record_id);
if (rc) {
raw_spin_unlock_irqrestore(&erst_lock, flags);
return rc;
}
rc = erst_get_record_id_next(&reader_pos, &record_id);
if (rc)
goto out;

/* no more record */
if (record_id == APEI_ERST_INVALID_RECORD_ID) {
raw_spin_unlock_irqrestore(&erst_lock, flags);
return 0;
rc = -1;
goto out;
}

len = __erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
erst_erange.size);
len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
erst_info.bufsize);
/* The record may be cleared by others, try read next record */
if (len == -ENOENT)
goto skip;
else if (len < 0) {
rc = -1;
goto out;
}
if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0)
goto skip;
raw_spin_unlock_irqrestore(&erst_lock, flags);

*id = record_id;
if (uuid_le_cmp(rcd->sec_hdr.section_type,
Expand All @@ -1005,7 +1033,8 @@ static size_t erst_reader(u64 *id, enum pstore_type_id *type,
time->tv_sec = 0;
time->tv_nsec = 0;

return len - sizeof(*rcd);
out:
return (rc < 0) ? rc : (len - sizeof(*rcd));
}

static u64 erst_writer(enum pstore_type_id type, size_t size)
Expand Down
12 changes: 9 additions & 3 deletions fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,27 @@ EXPORT_SYMBOL_GPL(pstore_register);
void pstore_get_records(void)
{
struct pstore_info *psi = psinfo;
size_t size;
ssize_t size;
u64 id;
enum pstore_type_id type;
struct timespec time;
int failed = 0;
int failed = 0, rc;

if (!psi)
return;

mutex_lock(&psinfo->buf_mutex);
rc = psi->open(psi);
if (rc)
goto out;

while ((size = psi->read(&id, &type, &time)) > 0) {
if (pstore_mkfile(type, psi->name, id, psi->buf, size,
if (pstore_mkfile(type, psi->name, id, psi->buf, (size_t)size,
time, psi->erase))
failed++;
}
psi->close(psi);
out:
mutex_unlock(&psinfo->buf_mutex);

if (failed)
Expand Down
4 changes: 3 additions & 1 deletion include/linux/pstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ struct pstore_info {
struct mutex buf_mutex; /* serialize access to 'buf' */
char *buf;
size_t bufsize;
size_t (*read)(u64 *id, enum pstore_type_id *type,
int (*open)(struct pstore_info *psi);
int (*close)(struct pstore_info *psi);
ssize_t (*read)(u64 *id, enum pstore_type_id *type,
struct timespec *time);
u64 (*write)(enum pstore_type_id type, size_t size);
int (*erase)(u64 id);
Expand Down

0 comments on commit 8e7bfcb

Please sign in to comment.