C H A P T E R  26

Lustre Troubleshooting

This chapter provides information to troubleshoot Lustre, submit a Lustre bug, and Lustre performance tips. It includes the following sections:


26.1 Lustre Error Messages

Several resources are available to help troubleshoot Lustre. This section describes error numbers, error messages and logs.

26.1.1 Error Numbers

Error numbers for Lustre come from the Linux errno.h, and are located in /usr/include/asm/errno.h. Lustre does not use all of the available Linux error numbers. The exact meaning of an error number depends on where it is used. Here is a summary of the basic errors that Lustre users may encounter.

Error Number

Error Name

Description

-1

-EPERM

Permission is denied.

-2

-ENOENT

The requested file or directory does not exist.

-4

-EINTR

The operation was interrupted (usually CTRL-C or a killing process).

-5

-EIO

The operation failed with a read or write error.

-19

-ENODEV

No such device is available. The server stopped or failed over.

-22

-EINVAL

The parameter contains an invalid value.

-28

-ENOSPC

The file system is out-of-space or out of inodes. Use lfs df (query the amount of file system space) or lfs df -i (query the number of inodes).

-30

-EROFS

The file system is read-only, likely due to a detected error.

-43

-EIDRM

The UID/GID does not match any known UID/GID on the MDS. Update etc/hosts and etc/group on the MDS to add the missing user or group.

-107

-ENOTCONN

The client is not connected to this server.

-110

-ETIMEDOUT

The operation took too long and timed out.

26.1.2 Viewing Error Messages

As Lustre code runs on the kernel, single-digit error codes display to the application; these error codes are an indication of the problem. Refer to the kernel console log (dmesg) for all recent kernel messages from that node. On the node, /var/log/messages holds a log of all messages for at least the past day.

The error message initiates with "LustreError" in the console log and provides a short description of:

Lustre logs are dumped to /proc/sys/lnet/debug_path.

Collect the first group of messages related to a problem, and any messages that precede "LBUG" or "assertion failure" errors. Messages that mention server nodes (OST or MDS) are specific to that server; you must collect similar messages from the relevant server console logs.

Another Lustre debug log holds information for Lustre action for a short period of time which, in turn, depends on the processes on the node to use Lustre. Use the following command to extract debug logs on each of the nodes, run

$ lctl dk <filename>

Note - LBUG freezes the thread to allow capture of the panic stack. A system reboot is needed to clear the thread.


26.2 Reporting a Lustre Bug

If, after troubleshooting your Lustre system, you cannot resolve the problem, consider reporting a Lustre bug. The process for reporting a bug is described in the Lustre wiki topic Reporting Bugs.

You can also post a question to the lustre-discuss mailing list or search the lustre-discuss Archives for information about your issue.

A Lustre diagnostics tool is available for downloading at: http://downloads.lustre.org/public/tools/lustre-diagnostics/

You can run this tool to capture diagnostics output to include in the reported bug. To run this tool, enter one of these commands:

# lustre-diagnostics -t <bugzilla bug #>
# lustre-diagnostics.

Output is sent directly to the terminal. Use normal file redirection to send the output to a file, and then manually attach the file to the bug you are submitting.


26.3 Common Lustre Problems

This section describes how to address common issues encountered with Lustre.

26.3.1 OST Object is Missing or Damaged

If the OSS fails to find an object or finds a damaged object, this message appears:

OST object missing or damaged (OST "ost1", object 98148, error -2)

If the reported error is -2 (-ENOENT, or "No such file or directory"), then the object is missing. This can occur either because the MDS and OST are out of sync, or because an OST object was corrupted and deleted.

If you have recovered the file system from a disk failure by using e2fsck, then unrecoverable objects may have been deleted or moved to /lost+found on the raw OST partition. Because files on the MDS still reference these objects, attempts to access them produce this error.

If you have recovered a backup of the raw MDS or OST partition, then the restored partition is very likely to be out of sync with the rest of your cluster. No matter which server partition you restored from backup, files on the MDS may reference objects which no longer exist (or did not exist when the backup was taken); accessing those files produces this error.

If neither of those descriptions is applicable to your situation, then it is possible that you have discovered a programming error that allowed the servers to get out of sync. Please report this condition to the Lustre group, and we will investigate.

If the reported error is anything else (such as -5, "I/O error"), it likely indicates a storage failure. The low-level file system returns this error if it is unable to read from the storage device.

Suggested Action

If the reported error is -2, you can consider checking in /lost+found on your raw OST device, to see if the missing object is there. However, it is likely that this object is lost forever, and that the file that references the object is now partially or completely lost. Restore this file from backup, or salvage what you can and delete it.

If the reported error is anything else, then you should immediately inspect this server for storage problems.

26.3.2 OSTs Become Read-Only

If the SCSI devices are inaccessible to Lustre at the block device level, then ldiskfs remounts the device read-only to prevent file system corruption. This is a normal behavior. The status in /proc/fs/lustre/health_check also shows "not healthy" on the affected nodes.

To determine what caused the "not healthy" condition:

To recover from this problem, you must restart Lustre services using these file systems. There is no other way to know that the I/O made it to disk, and the state of the cache may be inconsistent with what is on disk.

26.3.3 Identifying a Missing OST

If an OST is missing for any reason, you may need to know what files are affected. Although an OST is missing, the files system should be operational. From any mounted client node, generate a list of files that reside on the affected OST. It is advisable to mark the missing OST as ’unavailable’ so clients and the MDS do not time out trying to contact it.

1. Generate a list of devices and determine the OST’s device number. Run:

$ lctl dl 

The lctl dl command output lists the device name and number, along with the device UUID and the number of references on the device.

2. Deactivate the OST (on the OSS at the MDS). Run:

$ lctl --device <OST device name or number> deactivate 

The OST device number or device name is generated by the lctl dl command.

The deactivate command prevents clients from creating new objects on the specified OST, although you can still access the OST for reading.


Note - If the OST later becomes available it needs to be reactivated, run:

# lctl --device <OST device name or number> activate


3. Determine all files that are striped over the missing OST, run:

# lfs getstripe -r -O {OST_UUID} /mountpoint

This returns a simple list of filenames from the affected file system.

4. If necessary, you can read the valid parts of a striped file, run:

# dd if=filename of=new_filename bs=4k conv=sync,noerror

5. You can delete these files with the unlink or munlink command.

# unlink|munlink filename {filename ...} 

Note - There is no functional difference between the unlink and munlink commands. The unlink command is for newer Linux distributions. You can run munlink if unlink is not available.

When you run the unlink or munlink command, the file on the MDS is permanently removed.


6. If you need to know, specifically, which parts of the file are missing data, then you first need to determine the file layout (striping pattern), which includes the index of the missing OST). Run:

# lfs getstripe -v {filename}

7. Use this computation is to determine which offsets in the file are affected: [(C*N + X)*S, (C*N + X)*S + S - 1], N = { 0, 1, 2, ...}

where:

C = stripe count

S = stripe size

X = index of bad OST for this file

For example, for a 2 stripe file, stripe size = 1M, the bad OST is at index 0, and you have holes in the file at: [(2*N + 0)*1M, (2*N + 0)*1M + 1M - 1], N = { 0, 1, 2, ...}

If the file system cannot be mounted, currently there is no way that parses metadata directly from an MDS. If the bad OST does not start, options to mount the file system are to provide a loop device OST in its place or replace it with a newly-formatted OST. In that case, the missing objects are created and are read as zero-filled.

26.3.4 Fixing a Bad LAST_ID on an OST

Each OST contains a LAST_ID file, which holds the last object (pre-)created by the MDS[1]. The MDT contains a lov_objid file, with values that represent the last object the MDS has allocated to a file.

During normal operation, the MDT keeps some pre-created (but unallocated) objects on the OST, and the relationship between LAST_ID and lov_objid should be LAST_ID <= lov_objid. Any difference in the file values results in objects being created on the OST when it next connects to the MDS. These objects are never actually allocated to a file, since they are of 0 length (empty), but they do no harm. Creating empty objects enables the OST to catch up to the MDS, so normal operations resume.

However, in the case where lov_objid < LAST_ID, bad things can happen as the MDS is not aware of objects that have already been allocated on the OST, and it reallocates them to new files, overwriting their existing contents.

Here is the rule to avoid this scenario:

LAST_ID >= lov_objid and LAST_ID == last_physical_object and lov_objid >= last_used_object

Although the lov_objid value should be equal to the last_used_object value, the above rule suffices to keep Lustre happy at the expense of a few leaked objects.

In situations where there is on-disk corruption of the OST, for example caused by running with write cache enabled on the disks, the LAST_ID value may become inconsistent and result in a message similar to:

"filter_precreate()) HOME-OST0003: Serious error: 
objid 3478673 already exists; is this filesystem corrupt?"

A related situation may happen if there is a significant discrepancy between the record of previously-created objects on the OST and the previously-allocated objects on the MDS, for example if the MDS has been corrupted, or restored from backup, which may cause significant data loss if left unchecked. This produces a message like:

"HOME-OST0003: ignoring bogus orphan destroy request: 
obdid 3438673 last_id 3478673"

To recover from this situation, determine and set a reasonable LAST_ID value.


Note - The file system must be stopped on all servers before performing this procedure.

For hex < -> decimal translations:

Use GDB:

(gdb) p /x 15028
$2 = 0x3ab4

Or bc:

echo "obase=16; 15028" | bc

1. Determine a reasonable value for the LAST_ID file. Check on the MDS:

# mount -t ldiskfs /dev/<mdsdev> /mnt/mds
# od -Ax -td8 /mnt/mds/lov_objid

There is one entry for each OST, in OST index order. This is what the MDS thinks is the last in-use object.

2. Determine the OST index for this OST.

# od -Ax -td4 /mnt/ost/last_rcvd

It will have it at offset 0x8c.

3. Check on the OST. Use debugfs to check the LAST_ID value:

debugfs -c -R 'dump /O/0/LAST_ID /tmp/LAST_ID' /dev/XXX ; od -Ax -td8 /tmp/LAST_ID"

4. Check the objects on the OST:

mount -rt ldiskfs /dev/{ostdev} /mnt/ost
# note the ls below is a number one and not a letter L
ls -1s /mnt/ost/O/0/d* | grep -v [a-z] |
sort -k2 -n > /tmp/objects.{diskname}
 
tail -30 /tmp/objects.{diskname}

This shows you the OST state. There may be some pre-created orphans. Check for zero-length objects. Any zero-length objects with IDs higher than LAST_ID should be deleted. New objects will be pre-created.

If the OST LAST_ID value matches that for the objects existing on the OST, then it is possible the lov_objid file on the MDS is incorrect. Delete the lov_objid file on the MDS and it will be re-created from the LAST_ID on the OSTs.

If you determine the LAST_ID file on the OST is incorrect (that is, it does not match what objects exist, does not match the MDS lov_objid value), then you have decided on a proper value for LAST_ID.

Once you have decided on a proper value for LAST_ID, use this repair procedure.

1. Access:

mount -t ldiskfs /dev/{ostdev} /mnt/ost

2. Check the current:

od -Ax -td8 /mnt/ost/O/0/LAST_ID

3. Be very safe, only work on backups:

cp /mnt/ost/O/0/LAST_ID /tmp/LAST_ID

4. Convert binary to text:

xxd /tmp/LAST_ID /tmp/LAST_ID.asc

5. Fix:

vi /tmp/LAST_ID.asc

6. Convert to binary:

xxd -r /tmp/LAST_ID.asc /tmp/LAST_ID.new

7. Verify:

od -Ax -td8 /tmp/LAST_ID.new

8. Replace:

cp /tmp/LAST_ID.new /mnt/ost/O/0/LAST_ID

9. Clean up:

umount /mnt/ost

26.3.5 Handling/Debugging "Bind: Address already in use" Error

During startup, Lustre may report a bind: Address already in use error and reject to start the operation. This is caused by a portmap service (often NFS locking) which starts before Lustre and binds to the default port 988. You must have port 988 open from firewall or IP tables for incoming connections on the client, OSS, and MDS nodes. LNET will create three outgoing connections on available, reserved ports to each client-server pair, starting with 1023, 1022 and 1021.

Unfortunately, you cannot set sunprc to avoid port 988. If you receive this error, do the following:

options lnet accept_port=988

Note - You can also use the sysctl command to mitigate the NFS client from grabbing the Lustre service port. However, this is a partial workaround as other user-space RPC servers still have the ability to grab the port.

26.3.6 Handling/Debugging Error "- 28"

A Linux error -28 (ENOSPC) that occurs during a write or sync operation indicates that an existing file residing on an OST could not be rewritten or updated because the OST was full, or nearly full. To verify if this is the case, on a client on which the OST is mounted, enter :

lfs df -h

To address this issue, you can do one of the following:

A Linux error -28 (ENOSPC) that occurs when a new file is being created may indicate that the MDS has run out of inodes and needs to be made larger. Newly created files do not written to full OSTs, while existing files continue to reside on the OST where they were initially created. To view inode information on the MDS, enter:

lfs df -i

Typically, Lustre reports this error to your application. If the application is checking the return code from its function calls, then it decodes it into a textual error message such as No space left on device. Both versions of the error message also appear in the system log.

For more information about the lfs df command, see Checking File System Free Space.

Although it is less efficient, you can also use the grep command to determine which OST or MDS is running out of space. To check the free space and inodes on a client, enter:

grep '[0-9]' /proc/fs/lustre/osc/*/kbytes{free,avail,total}
grep '[0-9]' /proc/fs/lustre/osc/*/files{free,total}
grep '[0-9]' /proc/fs/lustre/mdc/*/kbytes{free,avail,total}
grep '[0-9]' /proc/fs/lustre/mdc/*/files{free,total}

Note - You can find other numeric error codes along with a short name and text description in /usr/include/asm/errno.h.

26.3.7 Triggering Watchdog for PID NNN

In some cases, a server node triggers a watchdog timer and this causes a process stack to be dumped to the console along with a Lustre kernel debug log being dumped into /tmp (by default). The presence of a watchdog timer does NOT mean that the thread OOPSed, but rather that it is taking longer time than expected to complete a given operation. In some cases, this situation is expected.

For example, if a RAID rebuild is really slowing down I/O on an OST, it might trigger watchdog timers to trip. But another message follows shortly thereafter, indicating that the thread in question has completed processing (after some number of seconds). Generally, this indicates a transient problem. In other cases, it may legitimately signal that a thread is stuck because of a software error (lock inversion, for example).

Lustre: 0:0:(watchdog.c:122:lcw_cb()) 

The above message indicates that the watchdog is active for pid 933:

It was inactive for 100000ms:

Lustre: 0:0:(linux-debug.c:132:portals_debug_dumpstack()) 

Showing stack for process:

933 ll_ost_25     D F896071A     0   933      1    934   932 (L-TLB)
f6d87c60 00000046 00000000 f896071a f8def7cc 00002710 00001822 2da48cae
0008cf1a f6d7c220 f6d7c3d0 f6d86000 f3529648 f6d87cc4 f3529640 f8961d3d
00000010 f6d87c9c ca65a13c 00001fff 00000001 00000001 00000000 00000001

Call trace:

filter_do_bio+0x3dd/0xb90 [obdfilter]
default_wake_function+0x0/0x20
filter_direct_io+0x2fb/0x990 [obdfilter]
filter_preprw_read+0x5c5/0xe00 [obdfilter]
lustre_swab_niobuf_remote+0x0/0x30 [ptlrpc]
ost_brw_read+0x18df/0x2400 [ost]
ost_handle+0x14c2/0x42d0 [ost]
ptlrpc_server_handle_request+0x870/0x10b0 [ptlrpc]
ptlrpc_main+0x42e/0x7c0 [ptlrpc]

26.3.8 Handling Timeouts on Initial Lustre Setup

If you come across timeouts or hangs on the initial setup of your Lustre system, verify that name resolution for servers and clients is working correctly. Some distributions configure /etc/hosts sts so the name of the local machine (as reported by the 'hostname' command) is mapped to local host (127.0.0.1) instead of a proper IP address.

This might produce this error:

LustreError:(ldlm_handle_cancel()) received cancel for unknown lock cookie
0xe74021a4b41b954e from nid 0x7f000001 (0:127.0.0.1)

26.3.9 Handling/Debugging "LustreError: xxx went back in time"

Each time Lustre changes the state of the disk file system, it records a unique transaction number. Occasionally, when committing these transactions to the disk, the last committed transaction number displays to other nodes in the cluster to assist the recovery. Therefore, the promised transactions remain absolutely safe on the disappeared disk.

This situation arises when:

If you know the exact reason for the error, then it is safe to proceed with no further action. If you do not know the reason, then this is a serious issue and you should explore it with your disk vendor.

If the error occurs during failover, examine your disk cache settings. If it occurs after a restart without failover, try to determine how the disk can report that a write succeeded, then lose the Data Device corruption or Disk Errors.

26.3.10 Lustre Error: "Slow Start_Page_Write"

The slow start_page_write message appears when the operation takes an extremely long time to allocate a batch of memory pages. Use these pages to receive network traffic first, and then write to disk.

26.3.11 Drawbacks in Doing Multi-client O_APPEND Writes

It is possible to do multi-client O_APPEND writes to a single file, but there are few drawbacks that may make this a sub-optimal solution. These drawbacks are:

26.3.12 Slowdown Occurs During Lustre Startup

When Lustre starts, the Lustre file system needs to read in data from the disk. For the very first mdsrate run after the reboot, the MDS needs to wait on all the OSTs for object pre-creation. This causes a slowdown to occur when Lustre starts up.

After the file system has been running for some time, it contains more data in cache and hence, the variability caused by reading critical metadata from disk is mostly eliminated. The file system now reads data from the cache.

26.3.13 Log Message ‘Out of Memory’ on OST

When planning the hardware for an OSS node, consider the memory usage of several components in the Lustre system. If insufficient memory is available, an ‘out of memory’ message can be logged.

During normal operation, several conditions indicate insufficient RAM on a server node:

For information on determining the MDS memory and OSS memory requirements, see Determining Memory Requirements.

26.3.14 Setting SCSI I/O Sizes

Some SCSI drivers default to a maximum I/O size that is too small for good Lustre performance. we have fixed quite a few drivers, but you may still find that some drivers give unsatisfactory performance with Lustre. As the default value is hard-coded, you need to recompile the drivers to change their default. On the other hand, some drivers may have a wrong default set.

If you suspect bad I/O performance and an analysis of Lustre statistics indicates that I/O is not 1 MB, check /sys/block/<device>/queue/max_sectors_kb. If the max_sectors_kb value is less than 1024, set it to at least 1024 to improve performance. If changing max_sectors_kb does not change the I/O size as reported by Lustre, you may want to examine the SCSI driver code.


1 (Footnote) The contents of the LAST_ID file must be accurate regarding the actual objects that exist on the OST.